breadcrumbs plugin change proposal

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
fredp
Forum Members
Forum Members
Posts: 218
Joined: Sun Jul 27, 2008 1:36 am
Location: USA

breadcrumbs plugin change proposal

Post by fredp »

Hi,

I'd like to propose two small changes to the breadcrumbs plugin source.   One is a code optimization in the HTML generating loop. The other is an enhancement to support a simple form of "ambient signifiers" using "enumerated" CSS classes for "non-current" breadcrumbs.   I've attached a file containing the proposed changes (to cmsms 1.6.5, in "patch" format).

The optimization replaces two "if" statements inside the HTML output loop with one "if" statement outside of the loop.

The enhancement adds a boolean 'enumerate' parameter.  When true, each (non current page) breadcrumb will be given a CSS class that is distinct from the others.  Specifically, a numeric suffix will be appended to the classid of each breadcrumb.  The further away from the current page, the greater the numeric value.  This is trivially implemented using the readily available loop index variable, $i.  Finally, if classid is not specified when enumerate is true, the class name "crumb" is used as a default.

Here is one example of how this might be used; given:

Code: Select all

{breadcrumbs starttext='You are here' root='Home' delimiter='>>' enumerate=1}

Code: Select all

#breadcrumbs span.lastitem {
  font-size: 100%;
}
#breadcrumbs a.crumb_1 {
  font-size: 95%;
}
#breadcrumbs a.crumb_2 {
  font-size: 90%;
}
#breadcrumbs a.crumb_3 {
  font-size: 85%;
...
the resulting breadcrumb elements will have their font-size reduced based on their "distance" from the "current" page:

    You are here:  Home  >> Census Data >> 1850

Where:
   Home crumb:Home    Census Data crumb:Census Data    1850 crumb:1850


Hope this is helpful,
Fred
Attachments

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

Last edited by fredp on Sat Sep 12, 2009 1:48 am, edited 1 time in total.
Nearly all men can stand adversity, but if you want to test a man's character, give him power.
- Abraham Lincoln
viebig

Re: breadcrumbs plugin change proposal

Post by viebig »

Good idea.

Regards

G
Post Reply

Return to “Developers Discussion”