本文整理汇总了PHP中template_edit函数的典型用法代码示例。如果您正苦于以下问题:PHP template_edit函数的具体用法?PHP template_edit怎么用?PHP template_edit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了template_edit函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_edit
function action_edit()
{
global $page, $pagestore, $ParseEngine, $version;
$pg = $pagestore->page($page);
$pg->read();
if (!$pg->mutable) {
die(ACTION_ErrorPageLocked);
}
$archive = 0;
if ($version != '') {
$pg->version = $version;
$pg->read();
$archive = 1;
}
template_edit(array('page' => $page, 'text' => $pg->text, 'timestamp' => $pg->time, 'nextver' => $pg->version + 1, 'archive' => $archive));
}
示例2: debug_msg
if (isset($_GET['action'])) {
$action = $_GET['action'];
}
if (isset($_POST['action'])) {
$action = $_POST['action'];
}
debug_msg("Action: " . $action, 5);
// Determine what action to take
switch ($action) {
case 'add':
template_add();
break;
case 'edit':
if (isset($_GET['id'])) {
$id = $_GET['id'];
template_edit($id);
}
break;
case 'delete':
if (isset($_GET['id'])) {
$id = $_GET['id'];
template_delete($id);
}
break;
case 'deleterecord':
if (isset($_POST['id'])) {
$id = $_POST['id'];
template_deleterecord($id);
}
break;
case 'insert':
示例3: form_actions
case 'actions':
form_actions();
break;
case 'rrd_add':
template_rrd_add();
break;
case 'rrd_remove':
template_rrd_remove();
break;
case 'template_remove':
template_remove();
header("Location: data_templates.php");
break;
case 'template_edit':
include_once "./include/top_header.php";
template_edit();
include_once "./include/bottom_footer.php";
break;
default:
include_once "./include/top_header.php";
template();
include_once "./include/bottom_footer.php";
break;
}
/* --------------------------
The Save Function
-------------------------- */
function form_save()
{
global $cnn_id;
if (isset($_POST["save_component_template"])) {
示例4: action_edit
function action_edit()
{
global $ErrorPageLocked, $page, $pagefrom, $pagestore, $ParseEngine;
global $section, $use_template, $UserName, $version;
$pg = $pagestore->page($page);
$pg->read();
if (!$UserName || !$pg->mutable) {
die($ErrorPageLocked);
}
$archive = 0;
if ($version != '') {
$pg->version = $version;
$pg->read();
$archive = 1;
}
$page_text = $pg->text;
// page template
if ($use_template) {
$tmpl_pg = $pagestore->page($use_template);
if ($tmpl_pg->exists()) {
$tmpl_pg->read();
$page_text = $tmpl_pg->text;
$archive = 0;
} else {
$use_template = '';
}
}
// section editing
$text_before = '';
$text_after = '';
if ($section) {
$lines = explode("\n", $page_text);
$lines_before = array();
$lines_after = array();
$lines_section = array();
$section_count = 0;
$found_level = 0;
foreach ($lines as $line) {
if (($result = parse_heading_line_match(strip_tags($line))) !== false && (!$found_level || strlen($result[2]) <= $found_level)) {
$section_count++;
}
if ($section_count < $section) {
$lines_before[] = $line;
} else {
if ($section_count > $section) {
$lines_after[] = $line;
} else {
if (!$found_level) {
$found_level = strlen($result[2]);
}
$lines_section[] = $line;
}
}
}
$text_before = implode("\n", $lines_before);
$text_after = implode("\n", $lines_after);
$page_text = implode("\n", $lines_section);
}
if (trim($page_text) == '') {
$page_text = "Describe {$page} here...\n\nPlease provide content before " . "saving.\n\n-- [{$UserName}]";
}
template_edit(array('page' => $page, 'pagefrom' => $pagefrom, 'text' => $page_text, 'section' => $section, 'text_before' => $text_before, 'text_after' => $text_after, 'timestamp' => $pg->time, 'nextver' => $pg->version + 1, 'archive' => $archive, 'template' => $pg->template, 'templates' => $pagestore->getTemplatePages(), 'use_template' => $use_template, 'edituser' => $pg->username, 'editver' => $UserName && $pg->mutable ? $version == '' ? 0 : $version : -1));
}