How do I add an Administration menu to a package?
posted by Stephan Borg on 01 Jul 2005 (12:24 UTC)
Well...
First you need a package/admin/admin_package_inc.php file, which will look something like this:

<?php
$formTinyMCEFeatures 
= array(
    
"tinymce_ask" => array(
        
'label' => 'WYSIWYG confirmation',
        
'note' => 'Ask before using the WYSIWYG editor tinymce when clicking on a textarea. If you disable this feature, we strongly suggest you enable HTML content format as the only content format and also disable quicktags.',
        
'page' => '',
    ),
);
$smarty->assign'formTinyMCEFeatures'$formTinyMCEFeatures );
if( !empty( 
$_REQUEST['change_prefs'] ) ) {
    foreach( 
$formTinyMCEFeatures as $item => $data ) {
        
simple_set_toggle$item );
    }
}
?>

You add more preference settings, by adding items to the $formPackageFeatures array. This essentially provides all the info to automatically generate the page, store and retrieve settings in an automated fashion (thanks to xing). The first part sets up the preferences and their descriptions, the second half is code to save the settings when the form is posted.

Then you need package/templates/menu_package_admin.tpl Smarty template, like this:

<?php
{strip}
<
ul>
    <
li><class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=tinymce">{tr}TinyMCE Settings{/tr}</a></li>
</
ul>
{/
strip}
?>

This actually creates the section and associated links in the Administration menu. Its fairly straightforward. Note use of
Permalink (referenced by: 0 posts references: 0 posts)