URL issue..

Author Message

Lo' F.

Monday 15 November 2010 2:05:19 pm

Hi!

In the top menu some of the items have a redirect to a specific subfolder controlled through an if condition..

...href={if $item.node_id|eq(200)}{'/content/view/full/220'|ezurl()}{elseif $item.node_id|eq(274)}{'/content/view/full/403'|ezurl()}{else}{$item.url_alias|ezurl}{/if}..

..but my client is not happy about the URL http://www.xxx.net/index.php/ita/content/view/full/403

he just wants the URL showing the complete path with folder and subfolder's names.

Since the site is in other languages, by giving the name of the folder ..

...href={concat($header_link.url, "/FolderName")|ezurl}...

.. it cannot find the object when browsing the eng siteaccess for instance.

I would like to avoid the use of translation in here ({'/FolderName'|i18n(/xxx/xxx/xxx)}) ...not practical specially if it's more than one case..

Is there a way I can pass the node_id and get its object name in the URL?

loredanaebook.it

Gaetano Giunta

Tuesday 16 November 2010 4:18:07 am

The switchlanguage/to module should do what you want. Urls will be slightly longer than needed, but still look better than contnet/view/full/xxx.

Translating object names is not only impractical but prone to many many errors. And you have to translate every element part of the path in the url...

Principal Consultant International Business
Member of the Community Project Board

Lo' F.

Thursday 02 December 2010 8:14:47 am

Hi Gaetano, thanks again for your replay and once again sorry for my delay in replying. Same old story (due to a priority matter...)

I have been searching for how to make use of switchlanguage/to module as you suggested but no luck indeed. If you can address me to a practical example I'd really appreciate.

Meawhile, because I had to get rid of the use of "content/view/full" I made up another solution...

Here is how I could redirect the parent node link to a specific child page:

Inside the top menu foreach ($items as $item)...

{def $redirect_to_page=""}
...
<a href={if $item.node_id|eq(200)}{set $redirect_to_page=fetch('content', 'node', hash('node_id', 220))}
{$redirect_to_page.path_with_names|ezurl}{else if...}...{else}...>{$item.name|wash()}</a>

Probably it's not the best but surely better than having to use translations (..even though don't need to apply to every menu item, just a few).

loredanaebook.it

Gaetano Giunta

Thursday 02 December 2010 11:01:43 am

I think I might have misunderstood the question.

If the question is: how do I make a menu that points to the "nice url" for menu items and that works for both the italian and english versions, the answer is pretty simple: fetch the node you want to link to (as you did), and use <code><a href={$node.url_alias|ezurl()}></code> This is by far the most common way of creating links to content within eZ Publish, btw.

If the question is: how do I make a menu that points to the "nice url" for menu items across languages (ie. that points to the english version of the node even though it is being displayed in the italian siteaccess), then switchlanguage/to is the answer.

Principal Consultant International Business
Member of the Community Project Board

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