OneThird CMS

Lightweight CMS for Small website, Web application framework.

Download Document


To make a surprisingly easy to set page / management screen (control panel)?

It might not be much in Web production, but certainly some settings in the Web app will require screen

So-called management screen, it is designed around the control panel

In other words, strings or numbers necessary to the system, for example, is the setting screen to be stored Toka password, Toka initial value, to the system

In OneThird CMS, such a case snippet_std_setting and I make a relatively easy to set screen With but a

In fact, there are ways to make it easier

It is a way to use the embed plug

This way, you can create even all over the program

For example, if you want to store the value of max_size is

In created page edit a page for setting (OK in normal page),


It is OK if you write a

It is surprisingly easy

Data: Because that says 'page top', it will be recorded as meta data of the top page

Please To confirm whether actually written is confirmed using the meta data manager

And if you call the recorded data in a program

You can read in the following two lines

$meta = get_theme_metadata();
$max_size = (int)$meta['plugin_embed']['max_size'];

Above is the most simple configuration screen, but in some cases you may want to initial value and maximum value, the minimum value, and the like fine operation

In that case, it becomes somewhat difficult, to create a template module, it is OK if you write a program in the following manner

Point, rather than use the $ plugin, is to use the $ plugin_proc

$buff = <<<EOT
	$html['article'][] = $buff;

On top of that, data modification during the event (onbefore_modified), please hook

Sample is what you set the minimum value

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

$buff = <<<EOT
	$html['article'][] = $buff;

function my_embed_onbefore_modified(&$r)
	global $params,$database;
	if ($r['meta']['plugin_embed']['max_size'] < 10) {
		$r['meta']['plugin_embed']['max_size'] = 10;

※ set of hooks, please set before calling the plugin_proc

In this way OneThird CMS, in addition to use the template tag in the template

Since gambling almost the same form in the page editing and program, you can be labor-saving When you take advantage of

Example: I entity of a string

$a = "{$ut->safe_echo($str)}";

Please come and take advantage

Google Website Translator - Google Translate