Loading...
 

What do you think?

What do you think of this project?



Anti-Bot verification code: Random Image

View Results
(Votes: 895)

"Your book is a big help because it shows me what can be done."
Is Smarties helpful?

Become a Fan

Become a fan.
http://facebook.com/twbasics
Become a fan.

Smart Tweets


Smart Readers



Advertising



[Show/Hide Left Column]

On the side.
| Share |Send link to a friend.
Print
Previous page Parent page Next page

Creating Custom Modules

When you added a poll to a module and included a menu in a module, you created a custom (albeit simple) module (i.e., a user module) instead of selecting a pre-defined module. In addition to adding Tiki objects (such as polls and menus) to modules, you can use HTML or Smarty syntax as well.
TipTip:
For detailed information on user modules, see Tiki Essentials(external link).




Using HTML

You can add custom HTML to a module. This allows you to add widgets, application, and scripts from other sources. For example, you can add an automatic weather forecast (from www.weatherreports.com(external link)) to a Tiki module. Simply create a new module and add the HTML code:

<script type="text/javascript" language="javascript1.2" src="http://weatherreports.com/jscript.html?width=125&height=125&theme=lred_no_search_box&location=Washington%2C%20DC&units=f"></script>
<div><a href="http://www.weatherreports.com/"><small>Free Weather Reports</small</a></div>


Create new user module.
Use the User Modules tab on the Admin: Modules page to create a new, custom module.


We'll convert this HTML to wiki syntax by using the JavaScript plugin.
  1. In the Data area, enter the following:
    {JS(file=>"http://weatherreports.com/jscript.html?width=125&height=125&theme=lred_no_search+box&location=Washington%2C%2ODC&units=f") /}[http://www.weatherreports.com/|Free Weather Reports]
  2. Enable the Must be wiki parsed option.
  3. Click Save. Tiki saves the information and displays the newly created module int he User Modules list.
    User modules.
    Your custom module.


  4. To display the module in a column, click the Assign button( Assign). The Assign/Edit modules tab appears.
  5. Complete the fields as shown in the Adding Modules section.

NoteNote:
After assigning the module, if Tiki displays the message WARNING: JS Plugin disabled, you must first enable the JavaScript plugin. See Enabling Plugins for more information.

If Tiki displays the message Plugin execution pending approval, you must approve the Javascript plugin. See Approving Plugins for more information.




Current weather module.
The module includes the weather report for Washington, DC.



Including Smarty

You can include Smarty syntax in your modules to do all sorts of neat things, such as displaying Tiki variables. For example, using this code:

Hello {if $user}{$user}{else}anonymous visitor{/if}!


will create a module that:
  • If the user is logged in, the module will show:
    Hello the user's name!
  • If the user is not logged in, the module will show:
    Hello anonymous visitor!

WarningWarning:
If you include Smarty coding in you templates, it must validate properly, or your pages will not display.

Refer to this troubleshooting tip if Tiki displays a message indicating a Fatal Smarty error.



Previous page Parent page Next page

Contributors to this page: Rick Sapir , Rogelio F. Galliano and System Administrator .
Page last modified on Wednesday, July 28, 2010 03:18:31 pm EDT by Rick Sapir.
The content on this page is licensed under the terms of the Copyright.

On the side.
| Share |Send link to a friend.
Print