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.