PHP Template Library Grows, Now Includes printNavAsList

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

printNavAsList

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>
            </ul>
        </li>
        <li><a href="links">links</a></li>
    </ul>
</div>


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).

printTagCloud

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.



<div class="sm_tag_cloud">
    <h3>TAG CLOUD</h3>
    <p>
        <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>
    </p>
</div>


printPageHead

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.

Related items
110 30th Ave North, Suite 5 | Nashville, TN 37203 | 615-301-2600 | 888-349-5578