How to display Image class with extra url

Author Message

Andreas Kaiser

Friday 22 December 2006 10:33:48 am

I've created a new content class similar to the image class, but with an extra datatype and the captation removed. The class has following structure:

1. Name [Text line]
2. Image [Image]
3. URL [Text line]

I can't use this code to show the image, because the url isn't "added" to the image.

{*{attribute_view_gui attribute=$random:item.object.data_map.image image_class='banner125'}*}

I've tried to use this code:

<a href="{$random:item.data_map.image_url.content}" title="xxx"><img src={$random:item.object.data_map.image.content[banner125].full_path|ezroot} alt="xxx" title="xxx" /></a>

My question is which code should I use for displaying the alt and title tag (with the alternative text field of the image datatype) or would there be another template code to show an image with an url...

Thanks and Happy Christmas to all the eZ Community!

eZ Partner in Madrid (Spain)
Web: http://www.atela.net/

Betsy Gamrat

Friday 22 December 2006 10:56:14 am

Andreas,

I did something similar. I created a new class with a URL attribute called <b>link</b> and an image called <b>image</b>. These are the templates:

<b>image_link_full.tpl</b>

<a href={$node.object.data_map.link.content} target='_blank'>{$node.name}<br>{attribute_view_gui attribute=$node.object.data_map.image}</a>

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 00:33:24
Script start
Timing: Jan 19 2025 00:33:24
Module start 'layout'
Timing: Jan 19 2025 00:33:24
Module start 'content'
Timing: Jan 19 2025 00:33:24
Module end 'content'
Timing: Jan 19 2025 00:33:24
Script end

Main resources:

Total runtime0.8524 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0080 588.0469152.6406
Module start 'layout' 0.00800.0034 740.687539.4766
Module start 'content' 0.01140.8395 780.1641533.8438
Module end 'content' 0.85090.0014 1,314.00788.1250
Script end 0.8523  1,322.1328 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.4080160.0002
Check MTime0.00130.1524160.0001
Mysql Total
Database connection0.00100.115010.0010
Mysqli_queries0.802794.1664540.0149
Looping result0.00060.0645520.0000
Template Total0.815395.720.4077
Template load0.00210.252020.0011
Template processing0.813295.398120.4066
Template load and register function0.00010.009010.0001
states
state_id_array0.00130.157110.0013
state_identifier_array0.00090.105120.0004
Override
Cache load0.00170.1964200.0001
Sytem overhead
Fetch class attribute can translate value0.00070.087520.0004
Fetch class attribute name0.00130.147640.0003
XML
Image XML parsing0.00090.104320.0004
class_abstraction
Instantiating content class attribute0.00000.000940.0000
General
dbfile0.00090.1047220.0000
String conversion0.00000.001340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs