Forums / Setup & design / Related objects : How to display an image instead of a link ?

Related objects : How to display an image instead of a link ?

Author Message

laurent le cadet

Friday 13 June 2003 2:02:08 am

eZ Publish 3.1.0-2

I'm trying to show an image in an article with the related objects fonction.
In the administration site it's correct but in the public site it just show a link.

How can I do ? Is it a problem with templates ?

Thanks for repply.

Jo Henrik Endrerud

Friday 13 June 2003 2:25:07 am

When you are placing a related object in an XML field a template called embed is used. The default embed.tpl file shows only the name of the object as a link. If you wish images to be shown differently you should make an override template for the embed.tpl file based on the image class and show the image the way you want.

Jo Henrik Endrerud | System Developer @ Seeds Consulting | http://www.seeds.no

laurent le cadet

Friday 13 June 2003 3:06:26 am

Hi Jo,

I think I can I copy and paste the template used in the admin site but I can't find it. I'm not able yet to write directly the corrects templates so I need example... :(

Laurent

laurent le cadet

Friday 13 June 2003 3:24:00 am

ALL RIGHT !

Thanks a lot...I activated the [Templates settings] in the site ini to find the path...copy and paste the embed.tpl in demo>override>templates>content>view ... It works !

Thanks for all.

A happy absolute beginner :)

Jo Henrik Endrerud

Friday 13 June 2003 5:42:09 am

This is great. If you are having problem finding the templates that is used you should try the Debug setting in the [DesignSettings] block in your configuration file. This will show you which templates are included where

Jo Henrik Endrerud | System Developer @ Seeds Consulting | http://www.seeds.no

Esben Maaløe

Wednesday 18 June 2003 7:06:06 am

In

[DesignSettings]

I added

Debug=enabled

AND i switched on debugoutput in [DebugSettings]

I get a lot of debug info - but none on templates

Could u elaborate how u do this ?

Esben Maaløe

Wednesday 18 June 2003 11:56:03 am

AHA

It is not in [DesignSettings] it is in [TemplateSettings] !

(this is true for 3.1 beta)

James Ward

Tuesday 29 July 2003 11:17:46 am

I copied the demo embed_class_5.tpl to my /override/templates/content/view/ directory. I cleared the template cache and refreshed the article but I am still getting a link instead of the image itself. I'm assuming because this is a content view template I do not need to add an entry in my override.ini to point to this file. With template debugging on it still says it is loading design/standard/templates/content/view/embed.tpl

Any idea what I missed? Thanks in advance.

working at www.wardnet.com
blogging at www.jamesward.ca

Alex Jones

Tuesday 29 July 2003 11:35:57 am

James, I believe you do need to add the template to your override.ini. Once you've done that and cleared the cache, it should work.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

James Ward

Wednesday 30 July 2003 12:59:57 pm

OK. I tried adding an image_embed record to my override.ini. Since there isn't one in the demo override.ini I'm not sure if mine is correct. This is what I tried:

[image_embed]
Source=node/view/embed.tpl
MatchFile=image_embed.tpl
Subdir=templates
Match[class]=5

I copied my image embed template to my design override/templates folder and renamed it image_embed.tpl. I emptied the template and ini cache but the page is still showing a link instead of the image and it is loading design/standard/templates/content/view/embed.tpl instead of my image_embed.tpl.

I assume there is something wrong with my override.ini definition. Any suggestions as to the correct definition?
Thanks in advance.

working at www.wardnet.com
blogging at www.jamesward.ca

James Ward

Wednesday 30 July 2003 3:26:40 pm

OK. The problem is definitely my override.ini setting. I replaced the standard embed.tpl with my image_embed.tpl and the image showed up in the article as I had hoped. So I guess the question is, what is wrong with this override.ini record?

[image_embed]
Source=node/view/embed.tpl
MatchFile=image_embed.tpl
Subdir=templates
Match[class]=5

What do I need to change in order to make this use my image_embed.tpl instead of the standard embed.tpl?

Thanks.

working at www.wardnet.com
blogging at www.jamesward.ca

andreas spahr

Tuesday 23 September 2003 4:13:31 am

As I can see, in the above statement the source is wrong.

Ok, what I did was following:
in the override.ini.append.php
[my_image_embed]
Source=content/view/embed.tpl
MatchFile=my_image_embed.tpl
Subdir=templates
Match[class]=5

The content of the File design/demo/override/templates/my_image_embed.tpl is following:

{default attribute_parameters=array()}
{attribute_view_gui attribute=$object.data_map.image image_class=original}
{/default}

Thats all.-;)