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.-;)

eZ debug

Timing: Jan 18 2025 04:16:16
Script start
Timing: Jan 18 2025 04:16:16
Module start 'content'
Timing: Jan 18 2025 04:16:16
Module end 'content'
Timing: Jan 18 2025 04:16:16
Script end

Main resources:

Total runtime0.2535 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 589.0859180.7969
Module start 'content' 0.00650.0051 769.8828105.9766
Module end 'content' 0.01170.2418 875.8594538.2031
Script end 0.2534  1,414.0625 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00351.3981200.0002
Check MTime0.00140.5689200.0001
Mysql Total
Database connection0.00050.215810.0005
Mysqli_queries0.208482.22201410.0015
Looping result0.00150.58231390.0000
Template Total0.241495.210.2414
Template load0.00100.376810.0010
Template processing0.240494.852810.2404
Override
Cache load0.00070.257610.0007
Sytem overhead
Fetch class attribute can translate value0.00070.293610.0007
XML
Image XML parsing0.00020.087910.0002
General
dbfile0.00200.7805200.0001
String conversion0.00000.002130.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs