|
Cookbook /
FeralFormattedEntrySummary: (:ffe:)...(:ffeend:) directive to output text via a template.
Version: 2007-04-18
File: feralformattedentry.phpΔ
Prerequisites: Tested with PmWiki 2.2.0 BETA
Status: Initial, apparently working.
Maintainer: Feral
Categories: Markup
Questions answered by this recipeHow do I separate the display of my text from the text itself? DescriptionA directive markup to output text via a template. NotesInstall by adding:
include_once("$FarmD/cookbook/feralformattedentry.php");
In your local/config.php. (or alternatively specific group's .php, etc.) Optional.If you wish to specify a default template page specify it before including, I.e.
$FFETemplate = 'MyFFETemplate';
include_once("$FarmD/cookbook/feralformattedentry.php");
Step by...
That is all there is to it. TemplateHow to change the display of your text:To change how your text is displayed, simply change the template page. NOTE that in your template page you should include the special variable markup How to use: (basic)If no template is specified, the current group's (:ffe template=FFEDisplayTemplate:) First line\\ Second line\\ Third line (:ffeend:) with the
{$$text}
Our output will be First line However, if we change our template only to say,
(:div2 style="border:1px solid purple;":)
{$$text}
(:div2end:)
Our output will be First line While just this is useful, we can also specify parameters to the directive and template. See below. How to use: (advanced)More useful is when we specify additional parameters for our template. In this example we shall add a parameter called 'header' although we may call it whatever we wish and include as many as we wish (such as header, footer, date, author, category, etc. Whatever YOU want.) (:ffe template=FFEDisplayTemplate header="Header Text":) First line\\ Second line\\ Third line (:ffeend:) To get at the 'header' parameter, we use the {$$parameter} notation, in this case So, with the
!{$$header}
{$$text}
Our directive above will result in, Header TextFirst line In this example we have added the 'header' param to our ffe directive and our template; Now every time we use this template page will will need to use this format. This may seem cumbersome at first glance, but more often than not our initial data is fixed and our layout changes later on. With this method our display is dictated by our template page, in this example this is with the
{$$text}
!{$$header}
Our directive above will result in, First line Header TextPossible usage:
Release Notes
CommentsSee AlsoContributors |