Creating the main plugin class

Well, now we have a good plugin name and the valid directory structure! It looks like we are all set to start doing something very cool with the plugin. Let's start from the creating a main plugin class.

Plug-in class should have the same name as plug-in's directory in the current example we will create Todo.php as plugin main class.

All plugins should extend the Seotoaser’s abstract plugin class - Tools_Plugins_Abstract. This class implements Seotoaster’s plugin specific interface and has a banch of useful methods to intialize all necessary helpers, hook up with the Seotoaster, etc... and will make your interaction with the system much easier.

For our todo plugin open (or create if you don’t have) the main class file Todo.php. And modify it to looks like example bellow:

class Todo extends Tools_Plugins_Abstract {

	/**
	 * Init method.
	 *
	 * Use this method to init your plugin's data and variables
	 * Use this method to init specific helpers, view, etc...
	 */
	protected function _init() {
		$this->_view->setScriptPath(__DIR__ . '/system/views/');
	}

There is only one method in this example, for now - _init(). We are using this method to initialize our plugin’s specific helpers, properties, etc... You should do the same for your plugin. For now in the _init we set view scripts path - the path where our view files (.phtml templates) will be stored

Note: $_view - instance of Zend_View class, inherited from the Tools_Plugins_Abstract

That's it! Our first plugin is ready! It can’t do anything yet, but we will make it better soon. Let's install it and try it in action.

DevNews