Page 1 of 1

Creating a simple sidebar plugin

Posted: Thu Nov 10, 2005 9:47 pm
by IFlo
I tried to create a simple sidebar plugin, but when I try to install it i only get an message like this at the plugin install page: "Error: my_plugin_name"

Where can I get more information what went wrong?

My plugin is until now only a directory serendipity_plugin_dglwiki with the file serendipity_plugin_dglwiki.php:

Code: Select all

<?php 
switch ($serendipity['lang']) {
    case 'en':
    default:
        @define('PLUGIN_DGLWIKI_PLUGIN_DESCRIPTION', 'Give some information about the DGL wiki');
        @define('PLUGIN_DGLWIKI_CAPTION', 'Caption');
        @define('PLUGIN_DGLWIKI_CAPTION_HINT', 'Explain here what the wiki is');
        break;
}

class serendipity_plugin_myclass extends serendipity_plugin
{
    function introspect(&$propbag)
    {
        global $serendipity;

        $propbag->add('name', COMMENTS);
        $propbag->add('description', PLUGIN_DGLWIKI_PLUGIN_DESCRIPTION);
        $propbag->add('stackable',     true);
        $propbag->add('author',        'Florian Koeberle');
        $propbag->add('version',       '0.1');
        $propbag->add('configuration', array('caption'));
        $propbag->add('groups', array('FRONTEND_EXTERNAL_SERVICES'));
        return true;
    }

    function introspect_config_item($name, &$propbag)
    {
        switch($name) {
            case 'caption':
                $propbag->add('type', 'string');
                $propbag->add('name', PLUGIN_DGLWIKI_CAPTION);
                $propbag->add('description', PLUGIN_DGLWIKI_CAPTION_HINT);
                break;
            default:
                return false;
        }
        return true;
    }

    function generate_content(&$title)
    {
        $title = PLUGIN_DGLWIKI_PLUGIN_DESCRIPTION;
        echo 'Test2';
    }
}
?>

Re: Creating a simple sidebar plugin

Posted: Thu Nov 10, 2005 11:02 pm
by garvinhicking
You must call your plugin file exactly like your plugin class name. So either rename your plugin file to serendipity_plugin_myclass.php, or rename the class to "serendipity_plugin_dglwiki". :)

Regards,
Garvin

Thank you!

Posted: Thu Nov 10, 2005 11:28 pm
by IFlo
Rename the class, solve the problem,
thank you!