Loading...
 

FeatureCreationDev

Getting Started With Feature Development

So, you've built a module (as explained in 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 items in the Application Menu
  • 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 be associated to at least one module. Examples would be the Wiki system or the Articles system.

Turning a Feature On/Off

tiki-admin-include-features.tpl

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.

Copy to clipboard
{tr}Features{/tr}
{tr}Tiki sections and features{/tr}
Copy to clipboard
Copy to clipboard

Feature Layout Notes


Keep in mind that the current admin-feature layout is a 5 column table that follows this pattern

{tr}Wiki{/tr}:
{tr}New Feature{/tr}:
{tr}Search{/tr}:
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.

tiki-admin_include_features.php

Copy to clipboard
$features_toggles = array( "feature_wiki",
Copy to clipboard
"feature_new_feature",
Copy to clipboard
"feature_polls",

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, if you want permissions inheritance (by example, tiki_p_view is assumed for someone with tiki_p_admin_wiki).

Adding links to your feature from the menus

Now that everything should be working, it's still suitable to get links from the menus to avoid having to enter the URL manually.

Application Menu

The Application Menu 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.
Note : a custom application menu, different from this one was introduced recently and the procedure, while it shouldn't be hard, lacks documentation here. Chealer9 20040329

Admin Menu

The AdminMenu is another module without PHP code. It is a single Smarty template ( /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

Created by: Last Modification: Wednesday 31 March 2004 05:29:49 GMT-0000 by Philippe Cloutier
List Slides