0

I am using this code in my menu:

{def $menu = treemenu( $module_result.path, false(), array( 'folder', 'article', 'page', 'listing', 'blog' ), 1, 2, true )}
{if $menu}
    <a href={$module_result.path[1].url_alias|ezurl} class="leftnavtop{cond(eq($current_node.node_id, $module_result.path[1].node_id), 'ON', '')}">{$module_result.path[1].text|shorten(24)|wash()}</a>
    {foreach $menu as $key => $item}
        <a class="{concat('leftnav', cond($item.level|eq(1), '2', ''), cond($item.is_selected, 'ON', ''))}" href={$item.url_alias|ezurl()}>{$item.text|shorten(32)|wash()}</a>
    {/foreach}
{/if}

With this name of link is taken from "short_name" and url is also from "short_name".

Is it possible to change little bit code so i have name of link taken from "name" and url to stay from "short_name".

Name: Name of link

Short Name: url example

Final Solution: Name of link (but goes to www.mysite.com/url-example)

Hope i explain it good.

I try few solutions but i had no luck.

Thanks in advance

Miller John
  • 41
  • 1
  • 3

2 Answers2

0

I don't typically generate my menu with treemenu(), so I do not know if you have access to the data_map from $item. That said, however, I would try this:

{def $menu = treemenu( $module_result.path, false(), array( 'folder', 'article', 'page', 'listing', 'blog' ), 1, 2, true )}
{if $menu}
    <a href={$module_result.path[1].url_alias|ezurl} class="leftnavtop{cond(eq($current_node.node_id, $module_result.path[1].node_id), 'ON', '')}">{$module_result.path[1].text|shorten(24)|wash()}</a>
    {foreach $menu as $key => $item}
        <a class="{concat('leftnav', cond($item.level|eq(1), '2', ''), cond($item.is_selected, 'ON', ''))}" href={$item.url_alias|ezurl()}>{$item.data_map.name.content|wash()}</a>
    {/foreach}
{/if}

Like I said, I don't know for sure if you have access to data_map from $item, but if you do you should be able to get the true name through it.

harmstyler
  • 1,381
  • 11
  • 20
  • Hey Tyler! Like I say this solution works fine to me. But can i do some coding for removing some inner pages from main page. For example i have MAIN PAGE (child pages: page 1-id nod 11, page 2-id nod 12, page 3-id nod 13, ). And i want to remove 2 of 3 child pages to be seen. I try {if array(11, 12)|contains($node_id)} {skip} {/if} but i have no luck. Can you please assist, i try few solutions more but i could'n find solution. Thanks in advance!!! – Miller John Aug 06 '13 at 10:38
0

Have you tried to modify url and name patterns in class description ?
You can use <short_name|name> to use first not blank field as node url or name.

Rey0bs
  • 1,192
  • 12
  • 19