This site has been archived. To learn more about our current products Ibexa Content, Ibexa Experience, Ibexa Commerce head over to the Ibexa Developer Portal

eZ Community » Projects » OW MultiSite

OW MultiSite

Wednesday 29 August 2012 - http://projects.ez.no/owmultisite

Provides multisite URL and INI tools for eZPublish

» Visit project page    » Project members    » Reviews

Latest forum activity - Visit project's forums page

Tuesday 07 May 2013 5:05:19 am

Hi Simon

Are you able to supply a basic example of use. I keep getting "Node not found. Please verify your input type or your SiteLanguageList settings". I had assumed that I was meant to override design/standard/templates/content/datatype/view/ezxmltags/link.tpl and use the owurl in there, but $node isn't available?

Thanks

Monday 13 May 2013 10:05:18 am

Hi Brendan,

The ezxmltags/link.tpl is provided by ezoe extension. By default, ezoe sadly doesn't provide $node variables in this templates

In ezxmltags/link.tpl, you can access to $object_id and $node_id variables if you enable this in datatype file :

You can do that :

<b>1. In kernel/datatypes/ezxmltext/handlers/output/ezxhtmlxmloutput.php</b>

In $OutputTags['link'] definition at top of file, replace

<code>

'object_id' => false,

'node_id' => false,

</code>

by

<code>

'object_id' => 'object_id',

'node_id' => 'node_id',

</code>

<b>2. In your link.tpl :</b>

<code>

{if first_set($node_id, false())}

{def $url = $node_id|owurl()}

{elseif first_set($object_id, false())}

{def $url = fetch('content', 'object', hash('object_id', $object_id)).main_node|owurl()}

{else}

{def $url = $href|ezurl(no,full)}

{/if}

<a href="{$url}"{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>

</code>

<b>3. Clear caches</b>

So, if you don't want modify kernel, you can properly override this in an extension :

http://share.ez.no/forums/developer/override-kernel-classes

http://www.ezpedia.org/solution/o...g_kernel_classes_within_an_extension

Tuesday 14 May 2013 6:05:17 am

Thanks Simon,

Presumably overriding templates/content/datatype/view/ezxmltags/link.tpl and adding

{def $node=fetch( 'content', 'node', hash( 'node_path', $href ) )}

to the top would achieve the same thing right?

Tuesday 14 May 2013 9:35:17 am

Maybe it can work !

Keep me informed happy.gif Emoticon

Have a good day

Wednesday 15 May 2013 8:05:17 am

HI Simon, just some feedback as requested. We used the following in our templates/content/datatype/view/ezxmltags/link.tpl

<code>{def $node=fetch( 'content', 'node', hash( 'node_path', $href ) )}

<a href={if is_object($node)}{$node.node_id|owurl()}{else}{$href|ezurl}{/if}

{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></code>

It appears to work, I have noticed sometimes the node can not be set but this hasn't happened on cross siteaccess links to hasn't been an issue. You could always test and if you feel its suitable perhaps include an override template in your extension.

Cheers

Wednesday 15 May 2013 9:35:16 am

Hi Brendan,

Thanks for your feedback.

If you want to optimize your template, you can replace

<code>{$node.node_id|owurl()}</code>

by

<code>{$node|owurl()}</code>

You will avoid a SQL request blunk.gif Emoticon

Members - Visit project's team page
Real name:
Simon Boyer
Country:
France 
#Posts:
54
Project reviews - See all reviews

Sunday 09 September 2012 1:35:02 pm

I think about it you did it !

To use as a complement to the language switcher (hmmm, we should rather say siteaccess switcher souldn't we ?)

Additionnaly, I think that an <xxx_vie_gui view=eview siteaccess=asiteaccess node=node> function will also be also a good idea

Keep going forward
Proudly Developed with from