This CMS is very simple to use to display "static" pages of information, and picture galleries.<br><br>
However, how to display dynamic elements, such as a form and the associated programs to treat the form results? The solution is: <b>plug-in</b>. The principle is simple: you write a function (which must be in php or have a php wrapper) for your custom content, and you inform similarly as with the links or embedded files the CMS that you target a plug-in.<br><br>
Of course, there are several rules, explained below on the example of a plug-in to let your name on the site called <code>Let_Your_Name</code>.<br><br>
You create a folder named <code>Let_Your_Name</code> within the existing <code>plugin</code> folder at the root of your domain. Your main functions must reside in a file named <code>index.php</code> within this folder. You can use this folder to store other php, html, picture or any file you need. You can even create sub-folders with <code>write</code> rights.<br><br>
In our example:<br>
<code>mysite.com/plugin/Let_Your_Name/  -- plug folder<br>
mysite.com/plugin/Let_Your_Name/index.php  -- main file<br>
mysite.com/plugin/Let_Your_Name/settings.php  -- advised: file containing the translations<br>
mysite.com/plugin/Let_Your_Name/pict.gif  -- a logo picture, for example<br>
mysite.com/plugin/Let_Your_Name/data/  -- a folder with write access for apache<br>
mysite.com/plugin/Let_Your_Name/data/names.txt  -- the file where you will store the names<br><br></code>
The file <code>index.php</code> must contain at least the following functions:<br>
<code>Let_Your_Name_title($lan)<br>
Let_Your_Name_content($lan)<br></code>
Note that the function manes contain the name of the plug-in also, i.e. you add _title or _content to your plugin name simply. The first function will be called when the CMS requires a title for the page of the plug-in; the second will be called when the CMS requires the content of the page. Both function recieve as input parameter only <code>$lan</code>, the 2-character language code which the user is using. You can ignore it and your plug-in will be available only in the language you write it in.<br><br>
Return a string from your function and the CMS will place it at the correct location. Do not output directly anything! At this point not even the headers have been sent out!<br><br>
In order to tell to the CMS that a given link leads to a plug-in, you proceed the same way as for e.g. embedded pages: The basic method is to add a file with the extension <i>.plug</i> at the location where the link should be placed.<br>
Within this file, give a string with the following structure:<br>
<code>text=<i>introductory text to display.</i>&name=<i>Name of the plug-in</i></code><br><br>
For example, put in the appropriate location a file <i>Leave_me_your_name.plug</i> and with the following content:<br>
<code>text=Dear visitor, leave your name and we will contact you when there is something new!&name=Let_Your_Name</code><br><br>
Et voila!<br><br>
How does this help you with dynamic content? Well you can do what you want in your php function, and you can in particular create a form. Your code may begin to check whether a particular $_GET variable is set. If no, display your form (which will set said variable); if yes, that means the form has been submitted and extract data and do what is needed.<br><br>
Of course, your program does not know that he is actually within a larger framework, so there is one more rule: you <b>must</b> use only the action method <b>GET</b>. How to define your action? Easy:<br>
<code>$output = "&lt;form action='http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/".$lan."/CSE_plugin' method=GET&gt;";<br>
$output .= "&lt;input type=hidden name=name value=<b>Let_Your_Name</b>&gt;";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// this is <b>mandatory</b> so that the CMS knows which plug-in to call.<br>
... // other form elements<br>
$output .= "&lt;/form&gt;";<br>
return $output;<br></code>
<br>
So an example of plug-in would be (very basic! no validation or anything):<br><br><pre>
function Let_Your_Name_title($lan) {
	return "Let your name";
}

function Let_Your_Name_content($lan) {
	if (isset($_GET["LYR"])) {
		// form is submitted
		$data = file_get_contents(dirname(__FILE__)."/data/CSE_name_list");
		$data .= $_GET["LYR_name"];
		$ok = file_put_contents(dirname(__FILE__)."/data/names.txt", $data, LOCK_EX);
		return "Thanks for letting your name, ".$_GET["LYR_name"];
	} else {
		// has to display the form
		$output = "&lt;form action='http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
		$output .= "/".$lan."/CSE_plugin' method=GET&gt;";
		$output .= "&lt;input type=hidden name=name value=Let_Your_Name&gt;";
			// this is <b>mandatory</b> so that the CMS knows which plug-in to call.
		$output .= "Your name: &lt;input type=text value='' name=LYR_name&gt;&lt;br&gt;";
		$output .= "&lt;input type=hidden name=LYR value=true&gt;";
		$output .= "&lt;input type=submit value='Let Your Name!'&gt;";
		$output .= "&lt;/form&gt;";
		return $output;
	}
}</pre><br>