Pages with Split Content

PanPage normally delivers web page content in a single chunk, typically between the banner above and the footer below, but you can split the content into several chunks if necessary.  It's currently fashionable, for example, to have as much content below the footer as above.

Conditional Rendering

The plain vanilla way to render a page of managed content is simply...

    $page->Render();

...and this renders all the columns on the page.  But if you supply an argument to the function you can pick and choose which columns will be rendered.  The argument is a text string representing one or more 'additional classes' that can be applied to columns.  For example...

    $page->Render("colSidebar");

...will render only columns that have the additional class 'colSidebar'.  Columns that don't have that class will be ignored.  Such a call might be used to render only the columns marked to appear in the sidebar area.  If you specifiy more than one class then columns matching either class will be rendered...

    $page->Render("colSidebar, colBelowFoot");

...will render columns that have the class 'colSidebar' or the class 'colBelowFoot'.  This is more commonly used with negation - below.

If the first character of the argument is an exclamation mark, '!', it reverses the effect.  So...

    $page->Render("!colAbove");

...will render only those columns that DON'T have class 'colAbove'.

Again specifying two or more column classes will render only columns that don't have either class...

    $page->Render("!colSidebar, colBelowFoot");

...will render only columns that don't have class 'colSidebar' or class 'colBelowFoot'.  This is a common way to render 'everything else' when you have specified some columns to be rendered in particular locations.

Splitting the page into multiple sections becomes a straight forward matter of applying column styles when you add columns to your pages.  You could bring the banner, page body and sub-footer areas under PanPage control with a page skeleton that makes appropriate conditional rendering calls.

    $page->Render("colBanner");
    ...
    $page->Render("!colBanner, colSubFooter");
    $page-RenderFooter();
    $page->Render("colSubFooter");

Defining Additional Classes

You define additional column classes in the PanPage theme file, pp_theme.php (in the theme folder), in two arrays...

    $cfgPP['ColumnAddStyles'] = array("colBanner", "colBelow");

...is an array of class names that can be applied to columns, and...

    $cfgPP['ColumnAddNames'] = array("In the Banner", "Below the Footer");

...is a corresponding array of friendly names for the classes.  These appear in the selection list when you create or edit a column.

Choosing Additional Classes

selecting additional column classes

You choose which additional classes (if any) to apply to a column when you create or edit it. 

Click in the list to select a single class and, since this is a multiple selection box, you can hold down the Ctrl key while you click on any further classes you want to select.

Styling Additional Classes

Additional classes can also used to apply styling to columns so you can add rules to your style sheet, eg...

    .colBanner  { font-size:1.5em; color:#000; }
    .colBelow  { font-size:1.0em; color:#fff; }

If you're just using these classes to select columns for rendering there's no need for them to appear in your style sheet.

This website uses cookies for statistical usage data. By continuing to use this site, you agree to the use of cookies.

Don't show this again