New breadcrumbs tag

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
rickb
Forum Members
Forum Members
Posts: 14
Joined: Mon Feb 23, 2009 12:55 pm

New breadcrumbs tag

Post by rickb »

I like to have clean separation of presentation from content.  The existing breadcrumb tag doesn't do this; instead it builds the presentation stuff into the HTML. So I wrote a new version of it (which I imaginatively called breadcrumbs2) that generates a sequence of list elements.  You just wrap it in a of your own choosing and write some CSS to make it look nice.

Most of the optional attributes were not strictly needed, so I simplified it by removing them.

Here's the additional admin text.

Code: Select all

$lang['admin']['about_function_breadcrumbs2'] = <<<EOT
<p>Author: Rick Beton <<a href="mailto:rick.beton at google's-own-mail.com">rick.beton at google's-own-mail.com</a>></p>
<p>Version: 1.0</p>
<p>
Change History:<br/>
</p>
EOT;

$lang['admin']['help_function_breadcrumbs2'] = <<<EOT
<h3>What does this do?</h3>
<p>Prints a breadcrumb trail as a navigation list.</p>
<h3>How do I use it?</h3>
<p>Just insert the tag into your template/page within a list like this:
<code><ul class="breadcrumb_trail">{breadcrumbs2}</ul></code>. The markup is designed to be easy to
decorate using CSS. Your CSS might draw from some ideas here:</p>
<pre>
div.navigation ul.breadcrumb_trail li {
    display: inline;
    list-style: none;
    font-size: 11px;
}
div.navigation ul.breadcrumb_trail li.parent {
    padding: 0 20px 0 0;
    background: url(/css/images/tab_right.png) right no-repeat;
}
div.navigation ul.breadcrumb_trail li.last {
    font-weight: bold;
    color: #555;
}
</pre>
<h3>What parameters does it take?</h3>
<p>
<ul>
<li><em>(optional)</em> <tt>root</tt> - Page alias of a page you want to always appear as the first page in
    the list. Can be used to make a page (e.g. the front page) appear to be the root of everything even though it is not.</li>
<li><em>(optional)</em> <tt>root_url</tt> - Override the URL of the root page. Useful for making link be to '/' instead of '/home/'. This requires that the root page be set as the default page.</li>
</ul>
</p>
EOT;
The attachment contains the new plugin.
Attachments

[The extension txt has been deactivated and can no longer be displayed.]

Last edited by rickb on Wed Mar 04, 2009 8:38 am, edited 1 time in total.
Post Reply

Return to “Developers Discussion”