If you have read our first blog post
you might know the below two principals followed by our forum's plugin system:
- A plugin must be very very very easy to develop
- A plugin must be able to modify every aspect of the forum without modifying the core
codoforum
folder and browse to sites/default/plugins/
. Create the plugin folder helloworld
here. Inside the folder create the required files helloworld.info.php
& helloworld.php
as shown in the image above.
myplugin
, then
the two files will be myplugin.info.php
& myplugin.php
helloworld.info.php
file tells codoforum that your plugin exists and adds it to the plugin management system in the backend so that it can be activated. As a minimum, the plugin name, version and core is required, but you can provide other information such as a description or author details. The info code can be seen below – this should be added to the helloworld.info.php
<?php
$info['name'] = 'Hello World';
$info['description'] = 'A Demo Plugin';
$info['version'] = '1.x';
$info['author'] = "codologic";
$info['author_url'] = 'http://codologic.com';
$info['license'] = 'MIT License';
$info['core'] = '1.x'; //works with which version of codoforum?
With that added to the info file, open up codoforum admin in your browser and have a look at the plugins section. The plugin should be listed, click enable to activate the plugin as shown below.
helloworld.php
file and copy the code shown below,
<?php
dispatch("helloworld/", function(){
echo "Hello, World!";
});
Now open your browser, and enter http://domain.com/index.php?u=helloworld
or
http://domain.com/helloworld
if you have enabled search engine friendly URLs.
you will recieve a raw output as shown below,
You just saw how to get raw output based on the URL by using the dispatch method, you can learn more about the dispatch method or move to the next part i.e how to display hello world in an existing layout/template.