Share » Forums » Setup & design » Retrieve Database by Priorities!

Retrieve Database by Priorities!

Retrieve Database by Priorities!

Friday 31 August 2007 2:32:55 am - 6 replies

Author Message

Guilherme Longo

Monday 03 September 2007 2:35:39 am

hello again!

nobody understood what i am meaning or it is something impossible to do?

thank

André R.

Monday 03 September 2007 3:42:16 am

Your first option actually, so try to rephrase your whole question.

An example of how to fetch multiple levels off menus and sort them using sorting form database can be found here:
http://zev.ez.no/svn/extensions/ezwebin/trunk/packages/ezwebin_extension/ezextension/ezwebin/design/ezwebin/templates/menu/flat_left.tpl

the part you are looking for is probably this: $item.sort_array

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

Guilherme Longo

Monday 03 September 2007 5:14:59 am

ok Andre, i'll try make a better explanation.
so, i'm using one template X
This template has 2 menu bars.

the first menu, is managed by web interface. When I include nodes in the top level tree of content, for exemple: Folder CUSTOMERS, the button CUSTOMERS appears in this menu.

the second menu, does'nt work like the first. For include buttons in the second menu, I need put code like that:

<li><a href={"/user/logout"|ezurl} title="{$pagedesign.data_map.logout_label.data_text|wash}">{$pagedesign.data_map.logout_label.data_text|wash} ( {$current_user.contentobject.name|wash} )</a></li>

directly in my template.

I want hide 1 button of my first menu, but i dont want put hidden directly by web interface, becouse all content of my button will be hidden too. I just want that the "button" does'nt appears in my web. HOW TO DO IT?

I think in sort the node of tree content by priority and using php, retrieve these priorities and make some code to hide the button that i want that does'nt appear.

IF I DID'NT EXPLANED RIGHT, PLEASE TELL ME WHERE, BECAUSE A DID'NT FIND HOW TO DO IT.

thank

André R.

Monday 03 September 2007 7:43:35 am

The most clean way to hide some of the links from the menu, is to use a class that does not show up in the menu.
You can use the advanced -> swap nodes in the javascript menu in the admin interface to swap the node out with another one.

Alternatively you can filter it out in you menu code with a simple:

{foreach $menu_nodes as $item}
{* filter out node id 355 *}
{if $item.node_id|ne( 355 )}
<li>...menu code...</li>
{/if}
{/foreach}

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

Guilherme Longo

Monday 10 September 2007 4:01:40 am

André, I've already adapted this code in my flat_top.tpl template.

look this:

{if $top_menu_items_count}
{foreach $top_menu_items as $key => $item}
{set $item_class = cond($current_node_in_path|eq($item.node_id), array("selected"), array())}
{if $key|eq(0)}
{set $item_class = $item_class|append("firstli")}
{/if}
{if $top_menu_items_count|eq( $key|inc )}
{set $item_class = $item_class|append("lastli")}
{/if}
{if $item.node_id|eq( $current_node_id )}
{set $item_class = $item_class|append("current")}
{/if}

{if eq( $item.class_identifier, 'link')}
<li id="node_id_{$item.node_id}"{if $item_class} class="{$item_class|implode(" ")}"{/if}><div><a href={if eq( $ui_context, 'browse' )}{concat("content/browse/", $item.node_id)|ezurl}{else}{$item.data_map.location.content|ezurl}{/if} target="_blank"{if eq( $ui_context, 'edit' )} onclick="return false;"{/if}><span>{$item.name|wash()}</span></a></div></li>
{else}

<b>{foreach $menu_nodes as $item}
{if $item.node_id|ne(170)}
<li id="node_id_{$item.node_id}"{if $item_class} class="{$item_class|implode(" ")}"{/if}><div><a href={if eq( $ui_context, 'browse' )}{concat("content/browse/", $item.node_id)|ezurl}{else}{$item.url_alias|ezurl}{/if}{if eq( $ui_context, 'edit' )} onclick="return false;"{/if}><span>{$item.name|wash()}</span></a></div></li></b>
<b>{/if}</b>
<b>{/foreach}</b>

{/if}
{/foreach}
{/if}

but, when i put this code, all buttons disappear from my menu bar.

I understood you wrong or is this implementation wrong?

Guilherme Longo

Monday 10 September 2007 5:47:35 am

Sorry André. Again you was right.

I was putting the code in one wrong part section.

I did like it:

{if $top_menu_items_count}
{foreach $top_menu_items as $key => $item}
<b>{if $item.node_id|ne(170)}</b>
{set $item_class = cond($current_node_in_path|eq($item.node_id), array("selected"), array())}
{if $key|eq(0)}
{set $item_class = $item_class|append("firstli")}
{/if}
{if $top_menu_items_count|eq( $key|inc )}
{set $item_class = $item_class|append("lastli")}
{/if}
{if $item.node_id|eq( $current_node_id )}
{set $item_class = $item_class|append("current")}
{/if}

{if eq( $item.class_identifier, 'link')}
<li id="node_id_{$item.node_id}"{if $item_class} class="{$item_class|implode(" ")}"{/if}><div><a href={if eq( $ui_context, 'browse' )}{concat("content/browse/", $item.node_id)|ezurl}{else}{$item.data_map.location.content|ezurl}{/if} target="_blank"{if eq( $ui_context, 'edit' )} onclick="return false;"{/if}><span>{$item.name|wash()}</span></a></div></li>
{else}
<li id="node_id_{$item.node_id}"{if $item_class} class="{$item_class|implode(" ")}"{/if}><div><a href={if eq( $ui_context, 'browse' )}{concat("content/browse/", $item.node_id)|ezurl}{else}{$item.url_alias|ezurl}{/if}{if eq( $ui_context, 'edit' )} onclick="return false;"{/if}><span>{$item.name|wash()}</span></a></div></li>
<b>{/if}</b>
{/if}
{/foreach}
{/if}

and is working perfect.
Thank you so much again!

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu