Add your own links
From ReOS Documentation Wiki
Before reading this article, you should read : Page_Layout_Customization
Contents |
Introduction
If you want to add a set of html links to your ReOS installation you can create a menu block in nav file of your template. Creating a menu block you add a XML node to ReOS XML output, that will be processed by XSL transformation.
In file /tpl/<theme_name>/nav2.xml you can define your links to internal or external content. You should add the following XML code in nav file, within header, footer, bleft, bright or even outside.
<mnu> <item link="pg=page&htm=about">ABOUTUS</item> <item href="/path/file.html">"My page link"</item> </mnu>
Internal Link
"About us" is an example of internal link. If you add an internal link you have to create the related content.
<mnu> <item link="pg=page&htm=about">ABOUTUS</item> </mnu>
This link will try to open file /tpl/theme/content/about.en.xml taking htm attribute and language code. In About.en.xml you can add your HTML content as it was XML or even just XML that will be processed by XSL transformation.
The XSL transformation takes your about.en.xml file and your XSL file /tpl/theme/... XSL file.
Example of about.en.xml file :
<content> <img src="../images/aboutus.jpg" title="About us" alt="About Us"/> <p>We are the best....</p> </content>
Example to template in XSL file :
<!-- TEMPLATE CONTENT --> <xsl:template match="content"> <div class="about"> <xsl:apply-templates /> </div> </xsl:template>
XSL transformation just copies all <content> node within a :
<div class="about">.... your xhtml ....</div>
External Link
If you want to have a link to your html page, use :
<mnu> <item href="/path/file.html">"My page link"</item> </mnu>
and create your html page in /path/file.html
href works like html anchor href attribute.
For example, members link of ReOS demo is an external link defined in nav file.
Identifing your set of links/Menu
If you create a mnu node in nav file, the result XML node name will be "mnu". If you want to identify your menu just add attribute name. For example :
<mnu name="mymnu"> <item link="pg=page&htm=about">ABOUTUS</item> <item href="/path/file.html">"My page link"</item> </mnu>
Translating links
If you want to have translated "My page link" text, you have to open file language /tpl/your_template/langs/lang_xx.php, where xx is the language code (en:English, es:Spanish...) and define a constant as follow :
define("_MYPAGELINK","My Page Link");
Then in /tpl/your_template/nav2.xml you have to create the link as follow :
<item href="/path/file.html">MYPAGELINK</item>
Same as before but without quotes on link description. Remember You have to add _MYPAGELINK in every language file in /tpl/your_template/langs/lang_xx.php

