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.

eZ debug

Timing: Jan 18 2025 05:00:34
Script start
Timing: Jan 18 2025 05:00:35
Module start 'layout'
Timing: Jan 18 2025 05:00:35
Module start 'content'
Timing: Jan 18 2025 05:00:36
Module end 'content'
Timing: Jan 18 2025 05:00:36
Script end

Main resources:

Total runtime1.5062 sec
Peak memory usage4,096.0000 KB
Database Queries60

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 587.7891152.6094
Module start 'layout' 0.00560.0038 740.398439.4063
Module start 'content' 0.00941.4955 779.8047560.9766
Module end 'content' 1.50490.0013 1,340.781316.2031
Script end 1.5062  1,356.9844 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.2235160.0002
Check MTime0.00130.0843160.0001
Mysql Total
Database connection0.00070.046110.0007
Mysqli_queries1.444595.9066600.0241
Looping result0.00060.0407580.0000
Template Total1.466697.420.7333
Template load0.00240.156620.0012
Template processing1.464297.211220.7321
Template load and register function0.00010.005810.0001
states
state_id_array0.00220.145810.0022
state_identifier_array0.00250.164320.0012
Override
Cache load0.00180.1223330.0001
Sytem overhead
Fetch class attribute can translate value0.00070.045220.0003
Fetch class attribute name0.00110.071260.0002
XML
Image XML parsing0.00110.075920.0006
class_abstraction
Instantiating content class attribute0.00000.001380.0000
General
dbfile0.00180.1211220.0001
String conversion0.00000.000640.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
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/emphasize.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/emphasize.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 22
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs