Page Translation

Translations that need improvement Translations that need improvement:

What do you think?

What do you think of this project?




View Results
(Votes: 816)
Cookies must be allowed to vote

"I find it very helpful, very clear in its presentation."
Is Smarties helpful?

Become a Fan

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

Smart Readers



Advertising




On the side.

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 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.



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>



Figure: Use the User Modules tab on the Admin: Modules page to create a new, custom module.
Create new user 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.
    Figure: Your custom module.
    User modules.


  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.




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



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, System Administrator... and 882 readers.
Page last modified on Friday, February 05, 2010 02:16:17 pm EST by Rick Sapir.
The content on this page is licensed under the terms of the Creative Commons Attribution-Share Alike 3.0 License.  
KeyContent.org logo. Published by KeyContent.org.