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.

<div class="cbox">
  <div class="cbox-title">{tr}Features{/tr}</div>
  <div class="cbox-data">
    <table width="100%"><tr>
      <td valign="top">
        <div class="simplebox">
          {tr}Tiki sections and features{/tr}
          <form action="tiki-admin.php?page=features" method="post">
            <table><tr>
              <td class="form">{tr}Wiki{/tr}:</td>
              <td><input type="checkbox" name="feature_wiki"
                  {if $feature_wiki eq 'y'}checked="checked"{/if}/></td>
            </tr><tr>
<td class="form">{tr}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">{tr}Search{/tr}:</td>
              <td><input type="checkbox" name="feature_search"
                  {if $feature_search eq 'y'}checked="checked"{/if}/></td>
            </tr><tr>

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.

tiki-admin_include_features.php

$features_toggles = array(
     "feature_wiki",
"feature_new_feature",
"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).

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


Page last modified on Wednesday 31 March 2004 05:29:49 GMT-0000

Upcoming Events

No records to display

Why Register?

Register at tiki.org and you'll be able to use the account at any *.tiki.org site, thanks to the InterTiki feature. A valid email address is required to receive site notifications and occasional newsletters. You can opt out of these items at any time.