wiki:xmenu

The menu node Xmenu.xml

If the node have static child node, they must be in a folder, inside the node.
In Xmenu.xml, you have to declare all childs (static or dynamic).

Static basic child

Example:

<?xml version="1.0" encoding="utf-8"?>                                                                                 
<menu xmlns="http://kazoe.org.free.fr/xsd/Xmenu.xsd" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <item name="toto">
        <title xml:lang="fr">Toto</title>
    </item>
    <item name="tutu">
        <title xml:lang="fr">Le Tutu</title>
        <title xml:lang="it">Il Tutu</title>
        <title xml:lang="en">The Tutu</title>
    </item>
</menu>

For a static child, you must create an "item" element with an attribute "name".
This name must be the name of the child folder.
In this example, if the node is "foo", the files organization is:

  • foo
    • Xpage.xml
    • Xmenu.xml
    • toto
      • Xpage.xml
    • tutu
      • Xpage.xml
      • Xmenu.xml

In this case, "toto" is a leaf page; and tutu have other child.

For all child, you must define an "title" element in the default language (in my case, FR -> french).
And, you can add all translations.

Conditional child

For all child, you can add a condition.
Example:

<?xml version="1.0" encoding="utf-8"?>                                                               
<menu xmlns="http://kazoe.org.free.fr/xsd/Xmenu.xsd" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <item name="adminusers" test="$Kz->canDo('section[@id=\'admin_users\']')">
        <title xml:lang="fr">Gestion utilisateurs</title>                     
    </item> 
</menu>

For conditional child, the "test" attribute is a PHP code.
The child is present only if this code return a TRUE boolean.
In this code, you can used the KaZoeObject?.

Dynamic Child

Example:

<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<menu xmlns="http://kazoe.org.free.fr/xsd/Xmenu.xsd" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <item_dyn_base name='news'>
        <query>
            SELECT
                name 
            FROM 
                kazoe_sections 
            WHERE 
                secname = 'news' 
            AND 
                kazoe_sections.id 
                    IN (
                       SELECT 
                           type 
                       FROM 
                           spc_news 
                       WHERE 
                           date_begin &lt; now() 
                       AND 
                           now() &lt; date_expire 
                       GROUP BY 
                           type 
                       HAVING 
                           count(*) > 0
                    )
        </query>
    </item_dyn_base>
</menu>

For a dynamic child (Database based), you use an "item_dyn_base" element.
You must use a SQL query in the "query" element. This query must return 1 value by element: the dynamic section name?