Loading...
 
Skip to main content

History: FeatureCreationDev

Preview of version: 15

Getting Started With Feature Development

So, you've built a Module ( ModuleCreationDev ) or two and are ready to build a full Feature?

I won't be delving too deeply into the internals of your feature, but instead focusing more heavily on the current system of integrating that feature into the rest of the TikiWiki framework. Basically, a feature needs to do several things:

  • Use ))AdminFeatures(( to turn itself On/Off
  • Initialize itself in php-setup
  • Display a menu in the ApplicationMenu
  • Expose itself for administration in either the Admin Menu or Section

Don't confuse a feature with a module ( ModuleCreationDev ). A feature is a full fledged application that is a major part of tikiwiki. In fact a feature will usually contain at least one module. Examples would be the Wiki system or the Articles system.


Turning a Feature On/Off

In tikiwiki, all features are enabled or disabled through the use of the Admin Control Panel Features which can be found in the control panel. It is quite simple to add your feature to this list. Just copy a line from an existing feature in the template file ( tiki/templates/tiki-admin-include-features.tpl ) and replace the old feature name with the new. Then do the same thing in the php file ( /tiki/tiki-admin.php ) so that the setting is recorded.


See tiki/templates/tiki-admin-include-features.tpl


<CODE><div class="cbox"> <div class="cbox-title">Features{/tr}</div> <div class="cbox-data"> <table width="100%"><tr> <td valign="top"> <div class="simplebox"> Tiki sections and features{/tr} <form action="tiki-admin.php?page=features" method="post"> <table><tr> <td class="form">Wiki{/tr}:</td> <td><input type="checkbox" name="feature_wiki" {if $feature_wiki eq 'y'}checked="checked"{/if}/></td> </tr><tr> <td class="form">New Feature{/tr}:</td> <td><input type="checkbox" name="feature_new_feature" {if $feature_new_feature eq 'y'}checked="checked"{/if}/></td> </tr><tr> <td class="form">Search{/tr}:</td> <td><input type="checkbox" name="feature_search" {if $feature_search eq 'y'}checked="checked"{/if}/></td> </tr><tr> . . .</CODE> Feature Layout Notes Keep in mind that the current admin-feature layout is a 5 column table that follows this pattern
checkbox name space (nbsp) checkbox name
You will need to properly modify the surrounding td elements so that you don't destroy the existing layout. Straight copy and paste will not result in desireable asthetics.
See tiki/tiki-admin.php
<CODE>' ' ' // Process Features form(s) if $_REQUEST%22features%22 { simple_set_toggle( "feature_wiki" ); simple_set_toggle( "feature_new_feature" ); simple_set_toggle( "feature_polls" ); . . .</CODE>
-

Initialization in tiki-setup.php

All tiki pages include /tiki/tiki-setup.php and therefore you need to place your initialization code here. Any pages that you develop within your feature should include this page as well. Some permissions may need to be set in tiki-setup_base.php as well, but that is more rare. This is an important note and is currently missing from the Tiki 1.6 documentation.

Adding to the ApplicationMenu

The ApplicationMenu is a module that doesn't actually include a single line of php code. It is entirely made up of a single SmartyTemplate ( /tiki/templates/modules/mod-application_menu.tpl ). To integrate you feature's menu, just copy an existing menu section and edit it to fit your needs.

Adding to the AdminMenu

The AdminMenu is another module without php code. It is a single SmartyTemplate ( /tiki/templates/modules/mod-admin_menu.tpl ). To integrate you feature's admin entry, just copy an existing menu item and edit it to fit your needs.

For the future

I am hoping that more of this config information can get moved to the database for version 2.0, but as for now, this file needs to be edited directly. If TikiWiki is to rule the world, this whole process needs to be pulled apart and made much more packageable... Please feel free to edit, remove or re-write this page

History

Advanced
Information Version
Philippe Cloutier Error, tpl->php 17
View
george.geller 15
View
Ben Tallman 13
View
Ben Tallman 12
View
Ben Tallman 11
View
Ben Tallman 10
View
Ben Tallman 9
View
Ben Tallman 8
View
Ben Tallman 7
View
Ben Tallman 6
View
Ben Tallman 5
View