custom tag not working with a link

Author Message

Antoine W.

Thursday 16 June 2005 8:33:35 am

Hello,

I'm creating a custom tag called 'extimg', to allow remote images insertion.

File design/plain/templates/content/datatype/view/ezxmltags/extimg.tpl contains : <img src="{$content}" />

I've added in settings/siteaccess/plain/content.ini.append.php :
[CustomTagSettings]
AvailableCustomTags[]=extimg
IsInline[extimg]=true

This tag works correctly with : <custom name='extimg'>http://www.../myimage.gif</custom>

But with a link, I get following result :
XML code: <link href='blabla'><custom name='extimg'>http://www.../myimage.gif</custom></link>
HTML Result: <b><a href="/plain/blabla>http://www.../myimage.gif</a>" /></b>
And image is not displayed.

Any idea ? Thanks.

Antoine W.

Thursday 23 June 2005 12:45:52 am

Due to XML rules, < link > tag does not allow <custom> tags as children.

The solution is to use an optional attribute for the link :

<custom name='extimg' src='http://.../image.png' href='http://website/page/'>

code for design/plain/templates/content/datatype/view/ezxmltags/extimg.tpl:

{section show=is_set($href)}<a href="{$href}"{section show=is_set($target)} target="{$target}"{/section}>{/section}
<img src="{$src}" />
{section show=is_set($href)}
</a>
{/section}

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 18 2025 22:17:28
Script start
Timing: Jan 18 2025 22:17:28
Module start 'layout'
Timing: Jan 18 2025 22:17:28
Module start 'content'
Timing: Jan 18 2025 22:17:29
Module end 'content'
Timing: Jan 18 2025 22:17:29
Script end

Main resources:

Total runtime0.6757 sec
Peak memory usage4,096.0000 KB
Database Queries52

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 589.4453152.6250
Module start 'layout' 0.00590.0038 742.070339.4453
Module start 'content' 0.00970.6642 781.5156428.6641
Module end 'content' 0.67390.0017 1,210.17978.1563
Script end 0.6756  1,218.3359 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.4666160.0002
Check MTime0.00130.1854160.0001
Mysql Total
Database connection0.00090.129110.0009
Mysqli_queries0.631693.4794520.0121
Looping result0.00050.0778500.0000
Template Total0.646595.720.3232
Template load0.00200.298120.0010
Template processing0.644595.383020.3222
Template load and register function0.00020.024410.0002
states
state_id_array0.00070.098510.0007
state_identifier_array0.00110.155720.0005
Override
Cache load0.00160.2431220.0001
Sytem overhead
Fetch class attribute can translate value0.00100.141910.0010
Fetch class attribute name0.00260.379720.0013
XML
Image XML parsing0.00010.013210.0001
class_abstraction
Instantiating content class attribute0.00000.001320.0000
General
dbfile0.00070.1059100.0001
String conversion0.00000.001440.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/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
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
2content/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: 13
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs