If the standard (legacy) modules of Tiki do not provide the functionality you need, it is easy to create a "Custom Module". This page shows you the necessary steps.
This section allows the creation of a new custom module.
Image missing - old was: {img src="img/wiki_up/admin_modules_07.png" align="center"}
You need to indicate the name (used in the select box to assign the module), the title and the data that will be displayed, the data must be HTML (any since you are admin). The right part of this panel can be used to help you include some objects that can be used in user modules, you can include in an user module:
Use 'Create New User Module' to create custom modules
Image missing - old was: {img src=http://doc.tiki.org/img/wiki_up/admin_modules_07.png align="center"}
Once a user module is created, it can be selected and assigned from the Module Name list, just like the standard modules available to the site.
When assigning a module you can set optional parameters to it.
{if $language eq 'fr'} {menu id=44} {elseif $language eq 'es'} {menu id=45} {else} {menu id=43} {/if}
The advantage of such code is to allow a default menu (id=43) when a translated version does not exist.
Inside the module, you can also display a menu depending on the user's group using the same syntax with the $group variable (which seems empty for Anonymous)
category[0]=9&category[1]=78&category[2]=79
nocategory[0]=9&nocategory[1]=78&nocategory[2]=79
category[]=22&category[]=23
(it will display the form to vote for the indicated poll)
+{poll id=n}
{poll}
{gallery id=-1 showgalleryname=1}
{gallery id=n showgalleryname=0}
{content id=n}
{rcontent id=n}
{rss id=n}
{banner zone=foo}
"normal menu" (Until Tiki 12.x)
just a normal menu
{menu id=n}
normal menu with auto close non-active sections
{menu id=n menu_cookie=n}
A normal menu with an automatic opening of the sections the current url is in and the sub-section of this url. The other sections will be closed automatically. There is no consideration of the cookies
normal menu with a custom class id
{menu id=n css_id=custom_name}
CSS/Suckerfish style
vertical
{menu id=n css=y bootstrap=n type=vert}
horizontal
{menu id=n css=y bootstrap=n type=horiz}
Bootstrap style (From Tiki 14.x +)
vertical
{menu id=n bootstrap=y type=vert}
horizontal
{menu id=n bootstrap=y type=horiz}
old way:
{wikistructure id=name}
Image missing - old was: {img src="img/wiki_up/admin_modules_08b.png" align="center"}
Note that there is a last checkbox to allow parsing the content of the menu, so that, wiki markup can be recognized and converted to html when showing the module in the browser (HomePage will be a clickable link then, in the previous example).
new way:
{menu structureId=name type=vert bootstrap=n css=y}
The following syntax can be used to display the current server date on a module:
{showdate mode="d/m/Y h:i"}
Where mode is any valid format for the PHP "date" function (see the date function on the PHP manual).
You can include dynamic blocks in a user module using a simple syntax:
Today quote: {content id=3}
In the example we are including the current version of the dynamic block 3 . You can create/edit and program dynamic blocks using the Dynamic Content System (DCS). Read about the DCS in the DCS section to learn more.
If you want you can include a banner in a user module, using the following syntax:
{banner zone=sidebar}
Where zone must be the name of an existing zone in the banners system and there should be at least one banner assigned to the zone (or nothing will be displayed). You can learn more about banners in the banners section.
You can display the form to vote a poll in a user module using the syntax
{poll id=n}
If you want Tiki to display the form to vote some (random) poll from all the active polls you can use:
{poll}
You can use the following function to display one random image from an image gallery:
{gallery id=n}
You can display the content of an RSS feed from another site in a user module after you created the feed (see using external RSS feeds later on this section), the syntax is:
{rss id=n max=m}
It will display the rss feed with id=n and it will display up to m elements from the feed.
A module is made up of one or two files:
The best way to begin, is to copy the one or 2 files from another module, to change the name of the files, the name of the php functions.
You can find an easy example in modules/mod-directory_stats.php , templates/modules/mod-directory_stats.tpl.
(Torsten once more answered comprehensive instead of updating the docs and linking, so he copy-pasted it here 😉 )
I want to create a custom footer very very much like the one at the bottom of this page, formatted the same way etc. I don't seem to be able to see a footer module.
Can anyone shed any light on this?
Thanks
Hello HadleysHope,
you could create a so called "custom module" and apply this to the footer module zone.
Please note: For step three below, I assume you have a Tiki 14 or 15 or trunk. For Tiki 12 it would be slightly different, as Tiki 12 not yet knows about the Bootstrap magic.
I assume, that you are not familiar with custom modules, so a few pointers:
1) What is a module
The Tiki integrated "legacy modules" (not an official name!), so the modules that are integrated from installation (in the Tiki code base) are literally simply containers with predefined content based on templates.
Templates contain HTML and smarty code and optionally can contain WikiSyntax aswell.
Custom modules are empty containers where you can write arbitrary HTML, smarty and WikiSyntax and then apply them to the module zones in the exact same way as you would do with the legacy modues.
Only one difference: with custom modules you do not have predefined fields for module specific parameters, but only one textbox, where you have to write the parameters and values manually.
2) Steps for a simple custom module in the footer like on this page/site
First you create a custom module in /tiki_adminmodules.php in the Tab "Custom Modules" and name it this way:
Name: test_footermenu
Title: test_footermenu
I always name them in lower case to distinguish them in the list from the legacy modules - but you are free to name and label (title) them differently and with upper case aswell.
The content of a module must not be empty, so we add some temporary code and to make it visible when applied:
<div style="background: red; height: 300px; width: 100%; font-weight: bold; color: black;">Hello, I am your new custom module. <br /> Test and enjoy!</div>
Second you go to the Tab "Assigned Modues" and click on the button "Add Module". You will find the newly created module in the drop down list which is offered to you to choose one.
Choose your new module and click on "Module Options".
Now you need to provide the necessary parameters in the parameters textbox.
Let's assume you want to not show the box and backgound and headng etc. of the module but only the plain content of the module, so we need nobox=y and we want to display the module only on the HomePage so we need page=HomePage
The syntax for the parameters and values would be following:
nobox=y&page=HomePage
Make sure to choose the module zone "bottom" (for the site footer) in the dropdown - default is "top". If you forget this, your module would be displayed in the header.
And voilà , when you open the HomePage in another Browser Tab, you will see a red 300px high rectangle in the footer with the text:
Hello, I am your new custom module.
Test and enjoy!
Three now:
Go back to the Tab "Custom Modules" and choose to edit your new custom module (you can keep it assigned, as the content will update. For testing on a production site you should create a wiki page "Test" and limit visibility to it (see above) with the parameter page=Test instead of page=HomePage.
You want 4 menus (created before, assuming they have the Id Numbers 44, 45, 46 and 73) besides each other and they shall flip below each other on a narrow screen. We do that with Bootstrap classes in the divs and we avoid inline styling!
The menus themselves you include with a little smarty magic.
Here we use non-bootstrap "classic" css menus.
Bootstrap class col-md-3:
col = column
md = middle viewport brakepoint = tablet landscape
3 = width = portion of 12th (1 = 1/12; 2 = 2/12; 3 = 3/12; ... 12 = 12/12)
<div class="row"> <!-- always wrap columns in a row - each row has "12 width" ! --> <div class="col-md-3"> <!-- 4 columns of "3 width" = 1 row of "12 width" --> {menu id=44 type=vert bootstrap=n css=y} <!-- this is the smarty magic --> </div> <!-- close the column --> <div class="col-md-3"> <!-- open the next column --> {menu id=45 type=vert bootstrap=n css=y} <!-- next menu --> </div> <!-- close the column --> <div class="col-md-3"> <!-- open the next column --> {menu id=46 type=vert bootstrap=n css=y} <!-- next menu --> </div> <!-- close the column --> <div class="col-md-3"> <!-- open the next column --> {menu id=73 type=vert bootstrap=n css=y} <!-- next menu --> </div> <!-- close the column --> </div> <!-- close the row -->
Dunno ! Save and check the footer on the page Test.
In case the menus would not be in the same line (stepped display) you can try the following (usually necessary with the similar setup with {DIV()}...{DIV} plugins on wiki pages, I do not off-hand know if ths is necessary with plain HTML in custom modules aswell (no time to test myself):
<div class="row"> <!-- always wrap columns in a row - each row has "12 width" ! --> <div class="col-md-3"> <!-- 4 columns of "3 width" = 1 row of "12 width" --> {menu id=44 type=vert bootstrap=n css=y} <!-- this is the smarty magic --> </div><div class="col-md-3"> <!-- close and open in the same line --> {menu id=45 type=vert bootstrap=n css=y} <!-- next menu --> </div><div class="col-md-3"> <!-- close and open in the same line --> {menu id=46 type=vert bootstrap=n css=y} <!-- next menu --> </div><div class="col-md-3"> <!-- close and open in the same line --> {menu id=73 type=vert bootstrap=n css=y} <!-- next menu --> </div> <!-- close the column --> </div> <!-- close the row -->