This tutorial will walk you through the steps for creating an addon that will replace an addon tag with the text Hello World. If you need to do any custom tag replacement (similar to how the built-in modules in the Geo software work), or insertion of text/HTML into a page, you can use this tutorial as a starting point.
Requires Geo 3.1 or higher.
<?php //file /addons/hello_world/info.php class addon_hello_world_info { var $name = 'hello_world'; var $version = '1.0.0'; var $title = 'Hello World'; var $author = "Hello World, Inc."; var $description = 'Displays "Hello World" wherever you want to, using the correct tag.'; var $auth_tag = 'my_addons'; var $tags = array ( 'display_hello_world' ); }
<
<?php //file: /addons/hello_world/tags.php class addon_hello_world_tags { function display_hello_world($params, $smarty){ //Note: The method name matches the tag name used in the $tags var in info.php return "Hello World!"; } }
<
{addon author='my_addons' addon='hello_world' tag='display_hello_world'} but don't take our word for it, verify that that is the tag name by looking at the details of the addon. <
This isn't the limit of what addons can do, to see everything addons can do get the example addon (should be a free addon in the client area). It demonstrates the use of tags, along with all of the other current abilities of addons. Plus, as long as you make your addon name unique enough (the addon's folder name), you shouldn't have to worry about having name conflicts with future addons.