OneThird CMS

Lightweight CMS for Small website, Web application framework.

Download Document

japanese

Creating a ToDo application (3): Changing the page title in conjunction with form registration

In the tutorial up to the last time, it did until the registration of ToDo form

Registration form, done by a combination of folder plug-ins and embed plug-ins

php program does not use

Here, you add the php program, to ensure that at the same time the page title to change the timing of ToDo form is changed


First, you need to catch the timing to correct the embed plugin

This is in advance, the hook in the embed plug-in side has been ready

hook that occur immediately before the change of embed plug-in I can be implemented with the following code


$plugin_ar[ EMBED_ID ]['onbefore_modified'] = 'my_hook';

function my_hook (&$page_ar) {

   Hook processing

}

We will change the global variable $plugin_ar directly

Page array The argument $page_ar of hook function is passed

In the case of embed, as it is the end of the case to return the hooks the processing to the normal route

If not, please explicitly returns false

It passes specifically the following

$ {For ()}

And title you have specified in page sequence, embed plug of the storage destination of name: The value is to rewrite if you did not match the processing of title sequence

It is to be noted that the page_ar, because it is called on all updated state, it does not matter even if it is modified in mod_data_items end


Next, although I do write in where the php program, this is done using the template module

In the previous code, put the following header, and save it as my_todo.php

global $plugin_ar;
$plugin_ar[ EMBED_ID ]['onbefore_modified'] = 'my_hook';

function my_hook (&$page_ar) {
	if (isset($page_ar['meta']['plugin_embed']['title']) && $page_ar['title'] != $page_ar['meta']['plugin_embed']['title']) {
		$page_ar['title'] = $page_ar['meta']['plugin_embed']['title'];
		if (!mod_data_items($page_ar)) {
			return false;
		}
	}
}
   


of them can file, files / 1 / plugin folder or, you can set up in any of the files / 1 / data folder


After, open the todoURL

Click the Edit icon in the page properties in lwr template, if you select myTodo is Ok


This will now work together automatically title and the title field in added Todo from the following


Next, make a list of Todo






Google Website Translator - Google Translate