eZ Community » Forums » Setup & design » Related objects : How to display an...
expandshrink

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

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

Friday 13 June 2003 11:02:08 am - 11 replies

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.

Friday 13 June 2003 11: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.

Friday 13 June 2003 12:06:26 pm

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... sad.gif Emoticon

Laurent

Friday 13 June 2003 12:24:00 pm

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 happy.gif Emoticon

Modified on Friday 13 June 2003 12:24:30 pm by laurent le cadet

Friday 13 June 2003 2:42:09 pm

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

Wednesday 18 June 2003 4:06:06 pm

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 ?

Wednesday 18 June 2003 8:56:03 pm

AHA

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

(this is true for 3.1 beta)

Tuesday 29 July 2003 8:17:46 pm

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.

Tuesday 29 July 2003 8:35:57 pm

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

Wednesday 30 July 2003 9: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.

Modified on Wednesday 30 July 2003 10:58:59 pm by James Ward

Thursday 31 July 2003 12:26:40 am

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.

Modified on Thursday 31 July 2003 1:26:31 am by James Ward

Tuesday 23 September 2003 1:13:31 pm

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.-blunk.gif Emoticon

Modified on Tuesday 23 September 2003 1:20:06 pm by Andreas S

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from