User Tools

Site Tools


en:public:developer:template_system:tags:navigation:tmenu:create

This is an old revision of the document!


<#TMenu.create>

You can use this tag to construct a TMenu object. A menu provides a space-saving way to let the user choose one of several options.

Parameters

Name Mandatory Default Description
Name Yes The name of the menu (must be the same as the name of the menu configured in the cfgpages xml file configuration)
Page_id No / Include in the menu only child items of the page defined by this parameter
VarName Yes The name of the variable that will be assigned to the newly created object. If the function is called from the tag <#Menu> then the name will be Menu
Template No If not empty then Parse this template with the new created TMenu object, return the result and free the object

cfgpages configuration

The menu is build like an hierarchical site structures (the parent pages of the current one). this hierarchical site structures is taken from the cfgpages.

Each <page> nodes in the cfgpages xml file must also contains in their <cfg><menus> child node one <menu> node that contain the neccessary params to build the menu

<page name="...">
  <cfg>
    ...
    <menus>
      <menu name='sitemap'>
        <visible>1</visible>
        <custom_name>custom_value</custom_name>
        <title>Real Estate</title>
      </menu>
    </menus>
    ... 
  </cfg>
</page>  
Name Default Description
<visible> No used to say if the current node must be show in the menu
<custom_name> you can define you custom var and you can access them after with <#current_menu_item.customsettings['custom_name']>
<title> used to set the current_menu_item.title. If empty title is taken from the <cfg><title> node

Example

<#{menu>
 
  <#{name>sitemap<#}name>
 
  <#{max_number_of_levels>2<#}max_number_of_levels>
 
  <#{template_container>
    <#menu_items.text>
    <div style='margin-bottom:10px;'>
      <#menu_items_lonely>
    </div>          
  <#}template_container>      
 
  <#{template_item>      
 
    <#if (#menu_current_item.level = 0) and (#menu_current_item.childs.count = 0)>
 
      <#{menu_items_lonely>         
        <#{setValue>
          <#menu_items_lonely>
          <#if condition="'<#menu_items_lonely hexencode=1>' <> ''">&nbsp;|&nbsp;<#endif>              
          <a style='line-height:18px;white-space:nowrap;zoom:1;font-weight:bold;<#if condition="'<#menu_current_item.customsettings['glyph'] hexencode=1>' <> ''">background:url(<#menu_current_item.customsettings['glyph']>) left top no-repeat;padding-left:20px;<#endif>' href='<#menu_current_item.url>'><#menu_current_item.title></a>
        <#}setValue>
        <#{Analyzetagparams>1<#}Analyzetagparams>
      <#}menu_items_lonely>   
 
    <#else>
 
      <#if #menu_current_item.level = 0>
 
        <div style='margin-bottom:10px;'>
          <table border='0' cellspacing='0' cellpadding='0' class='ak_default'>
            <tr>
              <td valign='top' style='white-space:nowrap;'><a style='line-height:18px;white-space:nowrap;zoom:1;font-weight:bold;<#if condition="'<#menu_current_item.customsettings['glyph'] hexencode=1>' <> ''">background:url(<#menu_current_item.customsettings['glyph']>) left top no-repeat;padding-left:20px;<#endif>' href='<#menu_current_item.url>'><#menu_current_item.title></a>&nbsp;&nbsp;|&nbsp;&nbsp;</td>
              <td valign='top'>
 
                <#{menu>
 
                  <#{name>sitemap<#}name>
 
                  <#{page_id><#menu_current_item.page_id><#}page_id>
 
                  <#{template_container>
                    <#menu_items_space setValue="">
                    <#menu_items.text>
                  <#}template_container>      
 
                  <#{template_item>              
                    <#menu_items_space>
                    <a style='line-height:18px;white-space:nowrap;' href='<#menu_current_item.url>'><#menu_current_item.title></a>
                    <#menu_items_space setValue="&nbsp;|&nbsp;">
                  <#}template_item>
 
                <#}menu>                    
 
              </td>
            </tr>
          </table>
        </div>
 
      <#endif>        
 
    <#endif>           
  <#}template_item>
 
<#}menu>
en/public/developer/template_system/tags/navigation/tmenu/create.1358944476.txt.gz · Last modified: 2013/01/23 16:34 by admin