Creating a simple sidebar plugin

Creating and modifying plugins.
Post Reply
IFlo

Creating a simple sidebar plugin

Post 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';
    }
}
?>
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Creating a simple sidebar plugin

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
IFlo

Thank you!

Post by IFlo »

Rename the class, solve the problem,
thank you!
Post Reply