How to override content/datatype/view/ezxmltags/link.tpl ?

Author Message

Samuel Torton

Tuesday 06 July 2010 5:45:47 am

Hi,

I have an issue for overriding the content/datatype/view/ezxmltags/link.tpl template.

I thought it was trivial... and it seems not to work.

This template is used when you put a link on a text in eZoe.

I have inserted the following lines in my override.ini.append.php file:

[link_image]
Source=content/datatype/view/ezxmltags/link.tpl
MatchFile=link/image.tpl
Subdir=templates
Match[class_identifier]=image

... and the link/image.tpl is not used when I insert a link to an image (I cleared all caches before, of course).

Any idea?

Thanks a lot.

Samuel Torton

Ivo Lukac

Tuesday 06 July 2010 6:44:00 am

Hm,

I think you missed a point here. Can you describe what you want to achieve? Always use different link.tpl or?

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

André R.

Tuesday 06 July 2010 6:58:12 am

The link it self does not have any override for class_identifier (if it does then that is probably something that comes from the object it is part of, for instance: article, and not the embed object bellow it in the structure: the image).

You can however do this kind of override for the <embed> tag (the actual relation to your image), as already done out of the box for embed image relations.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Samuel Torton

Tuesday 06 July 2010 7:06:40 am

Hi,

Here are some details about what I try to achieve.

When I had a link on my texte in ezoe, I want several kinds of links, ie:

. link to a "lightbox" for images;

. link to a "view full popup window" for videos;

. and the standard link for the other objects.

Thanks a lot for your replies.

Samuel Torton

Samuel Torton

Tuesday 06 July 2010 9:32:20 am

Hi,

Thank you very much for your replies, I now understand where my mistake was.

For your information, I found a workaround.

The "overriding" for this purpose can be done inside the content/datatype/view/ezxmltags/link.tpl code:

{def $mycontent = fetch(content, node, hash(node_path, $href))
$object_class = $mycontent.object.class_identifier
$attribute = ""
$url = false() }
{switch match=$object_class}
{case match='link'} specific code... {/case}
{case match='file'}
{set $attribute=$mycontent.data_map.file}
{set $url=concat( '/content/download/', $attribute.contentobject_id, '/', $attribute.id,'/version/', $attribute.version , '/file/', $attribute.content.original_filename|urlencode )}
<a href={$url|ezurl} target="_blank">{$content}</a>
{/case}
{case match='flash'} specific code... {/case}
{case match='image'} specific code... {/case}
{case}
<a href={$href|ezurl}
{if $id} id="{$id}"{/if}
{if $title} title="{$title}"{/if}
{if $target} target="{$target}"{/if}
{if $classification} class="{$classification|wash}"{/if}
{if and(is_set( $hreflang ), $hreflang)} hreflang="{$hreflang|wash}"{/if}
>
{$content}
</a>
{/case}
{/switch}
{undef}

Cheers,

Samuel Torton

André R.

Tuesday 06 July 2010 10:02:36 am

Ahh, now I see what you mean, you are linking to a specific content class object, while I thought you had an image as child of the link.

Created an enhancement issue for being able to override link depending on what you link to, with patch so feel free to try and give feedback to speedup the process:

http://issues.ez.no/IssueView.php?Id=16969&activeItem=1

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Samuel Torton

Wednesday 07 July 2010 3:46:21 am

Hi André,

Thank you for your reply.
Excuse me, I don't really understand your patch, and the change it is supposed to provide.

I've applied the patch on my kernel/classes/datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput.php file. What is the effect supposed to be provided ?

I have created the following entry in my override.ini.append.php:

[link_image]
Source=content/datatype/view/ezxmltags/link.tpl
MatchFile=link/image.tpl
Subdir=templates
Match[class_identifier]=image

And also created the following file: extension/[myExtension]/design/[myDesign]/override/templates/link/image.tpl

I created a page with several links to different objects & nodes.

I've cleared all caches.

But there is no change, whatever the object classes they are linked to, the applied template is still content/datatype/view/ezxmltags/link.tpl

Did I make a mistake? Or misunderstood your patch?

Samuel Torton

André R.

Wednesday 07 July 2010 8:35:34 am

Not sure, I did not test the patch. I'll try to do that when I have time for it.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

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