1 (edited by frankpeng 2011-11-22 17:34)

Topic: Hello World Extension

Hi, guys!

In order to make our own extensions, we have to make a hello world extension to get started.

This is my hello world extension. It inserts a new column in table topics. You can confirm it by looking at it in the database after installing it.
Then you can uninstall, the column will disappear.

It has only two files: index.html and manifest.xml

please name the folder as pun_helloworld and put in extensions directory

<html>
<head>
<title>.</title>
</head>
<body>
.
</body>
</html>

manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE extension SYSTEM "ext-1.0.dtd">

<!--
/**
** author: pccom.frank@hotmail.com
 */
-->

<extension engine="1.0">
        <id>pun_helloworld</id>
        <title>frank helloworld extension </title>
        <version>1.0.0</version>
        <description>Insert a column into database</description>
        <author>frank.pccom@hotmail.com</author>
        <minversion>1.3</minversion>
        <maxtestedon>1.4RC2</maxtestedon>

        <install><![CDATA[
if (!$forum_db->field_exists('topics', 'helloworld'))
        $forum_db->add_field('topics', 'helloworld', 'varchar(255)', false, '');

        ]]></install>

        <uninstall><![CDATA[
$forum_db->drop_field('topics', 'helloworld');
        ]]></uninstall>


</extension>

Some one please make a better hello world to display something.