Advanced sites menu

From GruppoZenit
Jump to: navigation, search

In order to have a complete overview of the menu forms that is possible to add to sites managed in Z-CMS, below are reported the two tables that stay at the basis of the menu structure.

WEB_MENU
MENUID The unique ID of the menu.
FK_MENU_ID The parent of menu ID, the menu is child.
PAGE_URL The page URL to which the page is mapped
SORT_ORDER The sort order of menu. If empty by default it is 1000
WEBSITE_ID The website ID to which the menu is related.
MENU_IDENTIFIER The identifier of the menu.
WEB_MENU_LANG
EXTERNAL_URL The external URL to be accessed using the menu.
MENU_NAME The name of the menu to be shown
NOTE The node that has been added to a menu
IMAGE1 The image to be used for a menu (to list the sub menu with images when main menu is clicked)
IMAGE2 The image to be used for a menu

By means of these tables it is possible to follow the example reported below on how to construct a complex menu structure inside a site.

<div id="menu">
   <ul>
      <zcms:content name="web_menu" id="parentMenu" alias="webmenu" standalone="true">
         <zcms:lookup-content name="web_menu_lang" join="inner" alias="WML">
            <zcms:content-relation content-attribute="menu_id" lookup-attribute="menu_id" joinwith="AND"/>
            <zcms:content-relation lookup-attribute="lang_code" value="$request[language]" />
         </zcms:lookup-content>
         <zcms:datacolumn name="WML.menu_name" alias="menu_name" />
         <zcms:datacolumn name="webmenu.menu_name" alias="menu_name1" />
         <zcms:filter attribute="fk_menu_id" value="IS NULL" plaintext="true" clause="true"/>
         <zcms:datacolumn name="webmenu.menu_id" alias="menu_id" />
         <zcms:dataorder attribute="sort_order" order="asc" /> 
         <zcms:filter attribute="website_id" value="$session[site]" />          
         <zcms:is operation="EQUALS" attribute="menu_identifier" value="$request[$1]">		  	
            <zcms:escape>
               <li class="selected">
            </zcms:escape>
            <zcms:else>
               <zcms:escape>
                  <li>
               </zcms:escape>
            </zcms:else>			
         </zcms:is>
         <zcms:is attribute="EXTERNAL_URL" operation="NOT_EMPTY">
            <zcms:escape>
               <a class="menu_first" href="#[zcms:attribute:EXTERNAL_URL]" target="_blank">
            </zcms:escape>
            <zcms:else>
               <zcms:escape>
                  <a class="menu_first" href="[zcms:attribute:page_url]">
               </zcms:escape>
            </zcms:else>
         </zcms:is>
         <p><span><zcms:attribute name="menu_name" /></span></p>
         <zcms:escape>
            </a>
         </zcms:escape>
         <zcms:content name="web_menu" id="childMenu" standalone="true">
            <zcms:lookup-content name="web_menu_lang" join="inner" alias="WML">
               <zcms:datacolumn name="WML.menu_name" alias="menu_name" />
               <zcms:content-relation content-attribute="menu_id" lookup-attribute="menu_id" joinwith="AND"/>
               <zcms:content-relation lookup-attribute="lang_code" value="$request[language]" />
            </zcms:lookup-content>
            <zcms:datacolumn name="WEB_MENU.menu_id" alias="menu_id" />
            <zcms:dataorder attribute="sort_order" order="asc" />
            <zcms:filter value="$result[*parent, menu_id]" attribute="fk_menu_id" />
            <zcms:begin>
               <zcms:escape>
                  <ul><li>
               </zcms:escape>
            </zcms:begin>
            <zcms:is operation="EQUALS" attribute="menu_identifier" value="$request[$2]">
               <zcms:is attribute="EXTERNAL_URL" operation="NOT_EMPTY">
                  <zcms:escape>
                     <a class="selected" href="#[zcms:attribute:EXTERNAL_URL]" target="_blank">
                  </zcms:escape>
                  <zcms:else>
                     <zcms:escape>
                        <a class="selected" href="[zcms:attribute:page_url]">
                     </zcms:escape>
                  </zcms:else>
               </zcms:is>
               <zcms:attribute name="menu_name" /> 
               <zcms:escape>
                  </a>
               </zcms:escape>
               <zcms:else>
                  <zcms:is attribute="EXTERNAL_URL"operation="NOT_EMPTY">
                     <zcms:escape>
                        <a href="#[zcms:attribute:EXTERNAL_URL]" target="_blank">
                     </zcms:escape>
                     <zcms:else>
                        <zcms:escape>
                           <a href="[zcms:attribute:page_url]">
                        </zcms:escape>
                     </zcms:else>
                  </zcms:is>
                  <zcms:attribute name="menu_name" /> 
                  <zcms:escape>
                     </a>
                  </zcms:escape>
               </zcms:else>
            </zcms:is>
            <zcms:end>
               <zcms:escape>
                  </li></ul>
               </zcms:escape>
            </zcms:end>
         </zcms:content>
         <zcms:close name="childMenu" />
         <zcms:escape>
            </li>
         </zcms:escape>   
      </zcms:content>
      <zcms:close name="parentMenu" />
   </ul>
</div>


See also

Personal tools
Namespaces

Variants
Actions
Toolbox