1 web393 Jan 20, 2010 01:44
3 web393 Jan 20, 2010 16:12
Thank you for your responding!
I would very much appreciate help with the plugin yes, I will start reading through this area of the documentation in the meantime but any tips and guidance is welcome :)
4 sam2kb Jan 20, 2010 20:06
You can get some ideas about how plugins work reading comments in plugins/test_plugin/
And you can start creating your own playing with plugins/skeleton.plugin.php
Basically your future plugin should include at least these 2 events
// This event will call the next one by creating a dummy "content" request
function AdminAfterMenuInit()
{
global $ctrl, $action;
if( $ctrl == 'items' && $action == 'new' )
{ // Dummy content, don't remove
$GLOBALS['content'] = ' ';
}
}
function FilterItemContents( & $params )
{
global $Blog;
// Get the main category
$main_category = param( 'post_category', 'integer', $Blog->get_default_cat_ID() );
$template = ''; // Default template, overwritten below
if( empty($main_category) )
{ // No category selected, use a common template
$template = 'No category selected';
}
else
{ // A category is selected,
// let's get a template for specific category ID
switch( $main_category )
{
case 4: // Category #4
$template = 'You selected category #4';
break;
case 22:
$template = 'Category #22, not a bad choice';
break;
default: // Some other category selected
$template = 'Some other category selected';
}
}
// Set our template
$params['content'] = $template;
return true;
}
Welcome to the forums!
There's no such option in default installation. Although you can do this with a very simple plugin.
I'll help you create a plugin if you want to.