PluginList advanced output control block | |
This section provides details on the use of wiki and Smarty templates that can be invoked with the OUTPUT control block. |
Wiki Formatting (In Separate Wiki Page) | |
(Available from Tiki8) This is effectively the same as Wiki Formatting Within Plugin - see PluginList OUTPUT control block - but with the difference that the formatting of each item in the search/filter result set can be defined in a separate wiki (template) page. First configure a LIST plugin using an OUTPUT control block to specify a wiki page where the wiki 'templating' will be defined, for example: Copy to clipboard
After that, create the wiki page template "ResultsTemplatePageName" in which you will put the following Copy to clipboard
If you want to use HTML in your template, the following is the correct way: Copy to clipboard
|
Results link to display an item in a template using wiki variables | |
In some cases you want your plugin list to display a list of trackeritems (customsearch, results, etc) and have the link to each item to display the tracker fields selected from within a template. You'll have to:
|
Results link to display an item in a template using alias | |
Another way to have the link to each item to display the tracker fields selected from within a template is to use Wiki Aliases You'll have to:
|
Advanced Smarty Formatting | |
For more advanced formatting the plugin can use Smarty templates stored on the server (parameter template) or on a Wiki page (parameter tplwiki). Whilst this is generally more complicated it is also much more flexible since the template is sent the search/filter result set as input and the template can contain logic to loop through the result set multiple times outputting the results in various ways and applying additional filtering logic if needed. The content of the output plugin control block is ignored when the smarty template parameter is set. Copy to clipboard
Copy to clipboard
However, you may also pass a variable to the smarty template in the body content of the OUTPUT tag. In the below example, you could access orientation using {$options.orientation} in your file.tpl smarty template. Copy to clipboard
|
Passing a value from a plugin List or CustomSearch into a smarty template | |
There are cases were you need to pass a value through a variable into your smarty template.
Copy to clipboard
|
Accessible variables: | |
In Tiki8, the following have been added:
Including Pagination To include pagination below the template, pagination=1 can be used, just like when using the wiki formatter. However, if you want to locate the pagination elsewhere, you can do it using Smarty. Skip the pagination=1 part.
Copy to clipboard
WARNING when using smarty IF:
Please note that if you are using smarty if or otherwise testing for the values of variables returned using the plain formatter, that the value of such variables is not just the string but has the For example: ~np~This is the string~/np~ From Tiki11, you can add You can also remove the ~np~ tags by using the Copy to clipboard
|
Example server stored Smarty Templates (TPL files) | |||||||||||||||||||||||
Copy to clipboard
This example also shows how further complex formatting can be achieved by using wiki plugins within the template itself - but as can see a different syntax/style must be used where the use of a plugin is flagged by the opening/closing 'wikiplugin' tags, the plugin name is indicated by the _name parameter and the individual plugin parameters are added in the normal way and can also be set from the data itself e.g. in the example above the code parameter for the 'addtocart' wiki plugin is set from the item/row data with:
Copy to clipboard
Copy to clipboard
Note: In Tiki 9.0 (at least) Copy to clipboard
~ first and the / )
|
All the LIST Plugin control blocks | |
|