Skip to content
Sitemason - Build on Us

PHP Template Library Grows, Now Includes printNavAsList

Sitemason's new PHP template library is slowly growing and we wanted to outline a few favorites.  Visit our Developer website to learn more.


One of the most oft-requested and certainly the most helpful methods is the new printNavAsList(); This single call publishes all of the menu items for a site as unordered lists, including nested if more than one level of navigation exists.

For example, for a site with two levels of navigation, using this call with the parameter to display all navigation items:

$content->printNavAsList(array('display_all' => 1));

Will output those navigation items as an HTML nested unordered list:

<div class="sm_nav">
    <ul class="l1">
        <li class="current"><a href="home" class="current">Home</a></li>
        <li><a href="blog">Blog</a></li>
        <li><a href="about">About Us</a>
            <ul class="l2">
                <li><a href="about/overview">Company Overview</a></li>
                <li><a href="about/history">Our History</a></li>
                <li><a href="about/staff">Our Staff</a></li>
                <li><a href="about/contact">Contact Us</a></li>
        <li><a href="links">links</a></li>

Some other parameters for printNavAsList let you declare a maximum or minimum number of levels to display, or even to skip the first item in navigation altogether (often useful for landing pages you don't want to appear in the navigation).


Tag Clouds are always fun, and now Sitemason allows you to create one in a single line. It outputs the cloud within an HTML class and gives it a specific font-size relative to the other tags in the cloud.

Tag Cloud screenshot

<div class="sm_tag_cloud">
    <h3>TAG CLOUD</h3>
        <a style="font-size: 18px" class="tag_cloud" href="tag_cloud?xtags=Article" title="Article">Article</a>
        <a style="font-size: 10px" class="tag_cloud" href="tag_cloud?xtags=Interview" title="Interview">Interview</a>
        <a style="font-size: 10px" class="tag_cloud" href="tag_cloud?xtags=Tutorial" title="Tutorial">Tutorial</a>
        <a style="font-size: 10px" class="tag_cloud" href="tag_cloud?xtags=Community" title="Community">Community</a>
        <a style="font-size: 10px" class="tag_cloud" href="tag_cloud?xtags=Education" title="Education">Education</a>
        <a style="font-size: 14px" class="tag_cloud" href="tag_cloud?xtags=Relief" title="Relief">Relief</a>
        <a style="font-size: 10px" class="tag_cloud" href="tag_cloud?xtags=Support" title="Support">Support</a>
        <a style="font-size: 18px" class="tag_cloud" href="tag_cloud?xtags=Volunteering" title="Volunteering">Volunteering</a>
        <a style="font-size: 10px" class="tag_cloud" href="tag_cloud?xtags=WRAP" title="WRAP">WRAP</a>



Take all of the work out of editing the <head> of a template, and add this simple line.  It uses the Sitemason shared template to populate the title, meta descriptions & keywords, as well as shared javascript and style sheets.

Billy White headshot thumbnail

Billy is a web developer and Chief Product Officer (CPO) at Sitemason, and has been with the company since 2006.  Read more about Billy White.

Contact Billy:

Recent Forum Posts

Warning: file_get_contents( failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /mnt/files/s/ on line 11 Warning: usort() expects parameter 1 to be array, null given in /mnt/files/s/ on line 14 Warning: Invalid argument supplied for foreach() in /mnt/files/s/ on line 17