本文整理汇总了PHP中Template::parse_template方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::parse_template方法的具体用法?PHP Template::parse_template怎么用?PHP Template::parse_template使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template::parse_template方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
function show($meldung = '')
{
if (defined('HTTPS') && HTTPS && !isset($_SERVER['HTTPS'])) {
header("Location: " . 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
}
if ($_SESSION['uuid']) {
$vars['uuid'] = $_SESSION['uuid'];
} else {
$vars['uuid'] = $_SESSION['uuid'] = General::uuid();
}
$template = $this->system->login_template ? $this->system->login_template : INSTALL_PATH . '/Templates/Login.template.html';
$login_form = new Template($template);
$meldungen = Template::get_all_parts($login_form->template);
$vars['meldung'] = $meldungen[$meldung] ? $meldungen[$meldung] : $meldung;
$vars['action'] = SELF_URL;
if (isset($_GET['logout'])) {
$vars['user'] = $_GET['logout'];
$vars['meldung'] = $login_form->parse_template('LOGOUT-MELDUNG', $vars);
return Html::div($login_form->parse_template('FORM', $vars));
}
if (!isset($_POST['user']) || !isset($_POST['pass'])) {
$vars['meldung'] .= Html::br() . $meldungen['KENNWORT_EINGEBEN'];
return Html::div($login_form->parse_template('FORM', $vars));
} else {
$vars['meldung'] .= Html::br() . $meldungen['FAIL'];
return Html::div($login_form->parse_template('FORM', $vars));
}
}
示例2: array
function make_table($sql = '', $template = '')
{
$db_table = $this->table;
$vars = is_array($this->template_vars) ? $this->template_vars : array();
$order_by = $this->order_by ? $this->order_by : 'id';
$order_dir = $this->order_dir ? $this->order_dir : 'ASC';
$results_per_page = $this->results_per_page ? $this->results_per_page : '';
$start_by = $_GET['start'] ? $_GET['start'] : 0;
if ($sql == '') {
$sql = "SELECT * FROM `{$db_table}` ORDER BY `{$order_by}` {$order_dir}";
}
$vars['pages'] = $this->get_pages($sql);
$vars['page'] = $this->get_page();
if ($results_per_page || $start_by) {
if (!$this->num_rows) {
$num_rows = $this->num_rows = $this->connection->db_num_rows($sql);
} else {
$num_rows = $this->num_rows;
}
if (!$results_per_page) {
$results_per_page = $num_rows;
}
$sql .= " LIMIT {$start_by},{$results_per_page}";
}
$result = $this->connection->db_assoc($sql);
$template = new Template($template);
$return_string = '';
$return_string .= $template->parse_template('PRE', $vars);
$alternatig_rows = 0;
$loop_count = 0;
$einzel = 0;
$row = '';
for ($i = 0; $i < ($count = count($result)); $i++) {
$loop_count++;
$result[$i] = array_merge($vars, $result[$i]);
foreach ($result[$i] as $key => $value) {
if (is_array($this->cols_array[$key]['options'])) {
$result[$i][$key] = $this->cols_array[$key]['options'][$value];
}
if ($this->cols_array[$key]['type'] == 'timestamp') {
$result[$i][$key] = intval(Date::unify_timestamp($value)) != '0' ? Date::timestamp2datum($value, $this->datumsformat ? $this->datumsformat : 'tag_kurz') : '';
}
if ($this->cols_array[$key]['type'] == 'upload') {
$result[$i][$key] = rawurlencode($value);
} elseif (!$this->cols_array[$key]['html']) {
$result[$i][$key] = htmlspecialchars($value);
}
}
$result[$i]['alt_row'] = ' alt_row_' . $alternatig_rows;
$return_string .= $template->parse_template('LOOP', $result[$i]);
$alternatig_rows = $alternatig_rows == 1 ? 0 : 1;
//$einzel = ($einzel == $this->results_per_page-1) ? 0 : $einzel++;
$einzel++;
}
$return_string .= $template->parse_template('POST', $vars);
return $return_string;
}
示例3: show
function show()
{
$page = new Template(INSTALL_PATH . '/Module/Kontakt/Kontakt.template.html');
$return_string = '';
$vars = array();
if (!$this->mail_sent) {
$return_string .= $page->parse_template('Formular', $vars);
} else {
$return_string .= $page->parse_template('Danke', $vars);
}
return $return_string;
}
示例4: main
function main()
{
global $db;
if (isset($_REQUEST['id'])) {
$result = $db->Execute("SELECT * FROM `Obsedb_Mods` WHERE `id` = '{$_REQUEST['id']}' LIMIT 1");
while ($row = $result->FetchNextObject()) {
do_header();
$header = new Template();
$header->open_template('cheats_header');
$header->addvar('{id}', $row->ID);
$header->addvar('{title}', stripslashes($row->TITLE));
$header->parse_template();
$header->print_template();
$cheats = $db->Execute("SELECT id,Modid,title,cheat FROM `Obsedb_cheats` WHERE `Modid` = '{$_REQUEST['id']}' ORDER BY `title`");
while ($cheat = $cheats->FetchNextObject()) {
// CHEAT HTML
echo "<b>" . clean($cheat->TITLE) . "</b><br />\n \t\t\t " . stripslashes($cheat->CHEAT) . "<br /><br />";
// END CHEAT HTML
}
do_footer();
}
} else {
do_header();
echo "<b>System Error Message</b><br />";
echo "You cannot access this page directly, please go back and select a Mod.<br />";
echo "If the problem persists, please contact the webmaster.";
do_footer();
}
}
示例5: view
function view()
{
global $db;
if (!is_numeric($_REQUEST['id'])) {
die("Critical Error: Aborting script operations.");
}
$result = $db->Execute("SELECT * FROM Obsedb_companies WHERE id = {$_REQUEST['id']} LIMIT 1");
$company = array();
$company['title'] = stripslashes($result->fields['title']);
$company['description'] = clean($result->fields['description']);
if (!empty($result->fields['homepage'])) {
$company['homepage'] = '<a href="' . stripslashes($result->fields['homepage']) . '" target="_blank">' . stripslashes($result->fields['homepage']) . '</a>';
}
if (!empty($result->fields['logo'])) {
$company['logo'] .= "<img src=\"";
$company['logo'] .= stripslashes($result->fields['logo']);
$company['logo'] .= "\" alt=\"" . $company['title'] . " align=\"right\" hspace=\"2\" vspace=\"2\">";
}
$result = $db->Execute("\n\t\t\tSELECT id, title, section, developer\n\t\t\tFROM Obsedb_Mods\n\t\t\tWHERE developer = " . $_REQUEST['id'] . "\n\t\t\tORDER BY title;");
while ($row = $result->FetchNextObject()) {
$company['dev_links'] .= '<a href="Moddetails.php?id=' . $row->ID . '">' . stripslashes($row->TITLE) . '</a><br />';
}
$result = $db->Execute("\n\t\t\tSELECT id, title, section, publisher\n\t\t\tFROM Obsedb_Mods\n\t\t\tWHERE publisher = " . $_REQUEST['id'] . "\n\t\t\tORDER BY title;");
while ($row = $result->FetchNextObject()) {
$company['pub_links'] .= '<a href="Moddetails.php?id=' . $row->ID . '">' . stripslashes($row->TITLE) . '</a><br />';
}
do_header();
$template = new Template();
$template->open_template('company_profile');
$template->addvar('{title}', $company['title']);
$template->addvar('{homepage}', $company['homepage']);
$template->addvar('{logo}', $company['logo']);
$template->addvar('{description}', $company['description']);
$template->parse_template();
$template->print_template();
if (!empty($company['dev_links'])) {
$company_profile_devlinks = new Template();
$company_profile_devlinks->open_template('company_profile_devlinks');
$company_profile_devlinks->addvar('{links}', $company['dev_links']);
$company_profile_devlinks->parse_template();
$company_profile_devlinks->print_template();
}
if (!empty($company['pub_links'])) {
$company_profile_publinks = new Template();
$company_profile_publinks->open_template('company_profile_publinks');
$company_profile_publinks->addvar('{links}', $company['pub_links']);
$company_profile_publinks->parse_template();
$company_profile_publinks->print_template();
}
do_footer();
}
示例6: show
function show($meldung = '')
{
if (defined('HTTPS') && HTTPS && !isset($_SERVER['HTTPS'])) {
header("Location: " . 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
}
$vars['uuid'] = $_SESSION['uuid'] = General::uuid();
$template = $this->system->login_template ? $this->system->login_template : INSTALL_PATH . '/Templates/Login.template.html';
$login_form = new Template($template);
$meldungen = Template::get_all_parts($login_form->template);
$vars['meldung'] = $meldungen[$meldung] ? $meldungen[$meldung] : $meldung;
$vars['action'] = SELF_URL;
if (isset($_GET['logout'])) {
$vars['user'] = $_GET['logout'];
$vars['meldung'] = $login_form->parse_template('LOGOUT-MELDUNG', $vars);
}
if (isset($_GET['recover'])) {
if ($_POST['recover_submit']) {
$email = General::input_clean($_POST['email'], true);
foreach ($this->system->user_tables as $t) {
$sql = "SELECT * FROM `{$t}` WHERE `E-Mail` = '{$email}'";
$result = $this->system->connection->db_single_row($sql);
if ($result) {
break;
}
}
if ($result) {
$mail = $login_form->parse_template('RECOVER_MAIL', $result);
mail($result['E-Mail'], 'Ihr ' . PROJECT_NAME . ' Passwort', $mail, 'From: ' . PROJECT_NAME . '<noreply@' . preg_replace('/^www\\./i', '', $_SERVER['HTTP_HOST']) . '>');
return $login_form->parse_template('RECOVER_THANKYOU', $result);
} else {
return $login_form->parse_template('RECOVER_NOFOUND', $result);
}
} else {
$vars['meldung'] = 'Bitte geben Sie Ihre E-Mail-Adresse ein: ';
}
return Html::div($login_form->parse_template('RECOVER_FORM', $vars));
}
if (!isset($_POST['user']) || !isset($_POST['pass'])) {
$vars['meldung'] .= Html::br() . $meldungen['KENNWORT_EINGEBEN'];
return Html::div($login_form->parse_template('FORM', $vars));
} else {
/*if ($this->check_login($system))
{
//if (HTTPS) header("Location: ".'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
header("Location: ".'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']);
}
else
{*/
$vars['meldung'] .= Html::br() . $meldungen['FAIL'];
return Html::div($login_form->parse_template('FORM', $vars));
// }
}
}
示例7: main
function main()
{
global $db;
// Get Mod Info
if (isset($_REQUEST['id'])) {
$result = $db->Execute("SELECT * FROM `Obsedb_Mods` WHERE `id` = '{$_REQUEST['id']}' LIMIT 1");
while ($row = $result->FetchNextObject()) {
$cheats = $db->Execute("SELECT id,Modid FROM `Obsedb_cheats` WHERE Modid = {$_REQUEST['id']} LIMIT 1");
if ($cheats->RecordCount() >= 1) {
$cheat_link = "<a href=\"cheats.php?id={$row->ID}\">Cheats</a>";
} else {
$cheat_link = "Cheats";
}
do_header();
$tplHeader = new Template();
$tplHeader->open_template('downloads_header');
$tplHeader->addvar('{title}', stripslashes($row->TITLE));
$tplHeader->addvar('{id}', $row->ID);
$tplHeader->addvar('{cheat_link}', $cheat_link);
$tplHeader->parse_template();
$tplHeader->print_template();
$downloads = $db->Execute("SELECT id,Modid,title,download FROM `Obsedb_downloads` WHERE `Modid` = '{$_REQUEST['id']}' ORDER BY `title`");
while ($download = $downloads->FetchNextObject()) {
// DOWNLOAD HTML
echo "<a href='" . stripslashes($download->DOWNLOAD) . "'>" . clean($download->TITLE) . "</a><br /><br />";
// END DOWNLOAD HTML
}
$tplFooter = new Template();
$tplFooter->open_template('downloads_footer');
$tplFooter->parse_template();
$tplFooter->print_template();
do_footer();
}
} else {
do_header();
echo "<b>System Error Message</b><br />";
echo "You cannot access this page directly, please go back and select a Mod.<br />";
echo "If the problem persists, please contact the webmaster.";
do_footer();
}
}
示例8: mailbag_main
function mailbag_main()
{
global $db;
do_header();
$tplHeader = new Template();
$tplHeader->open_template('mailbag_header');
$tplHeader->print_template();
$tplItem = new Template();
$tplItem->open_template('mailbag_item');
$result = $db->Execute("SELECT * FROM `Obsedb_mailbag` ORDER BY `id` DESC");
while ($row = $result->FetchNextObject()) {
$tplItem->addvar('{title}', stripslashes($row->TITLE));
$tplItem->addvar('{message}', clean($row->MESSAGE));
$tplItem->addvar('{reply}', clean($row->REPLY));
$tplItem->parse_template();
$tplItem->print_template();
}
$tplFooter = new Template();
$tplFooter->open_template('mailbag_footer');
$tplFooter->print_template();
do_footer();
}
示例9: ConstructPage
function ConstructPage($pObj)
{
$this->pObj = $pObj;
$template = $pObj->page_props['Template'];
$anc = array_reverse($pObj->page_props['Ancestors']);
while (!$template && $anc) {
$template = $anc[0]['Template'];
array_shift($anc);
}
$template = $template ? $template : INSTALL_PATH . '/Templates/Default.template.html';
//$pObj->page_props['Module'] = 'Admin()';
$content = ($mod = $pObj->page_props['Module']) ? "{Modul:{$mod}}" : INSTALL_PATH . '/Content/' . $pObj->page_props['File'] . '/content.html';
$content = new Template($content, $this->pObj);
$parsed_content = $content->parse_template('', $this->pObj->page_props);
$this->pObj->page_props = $content->pObj->page_props;
$this->pObj->page_props['MAIN_CONTENT'] = $parsed_content;
$template = new Template($template, $this->pObj);
$parsed_template = $template->parse_template('BODY', $this->pObj->page_props);
$this->pObj->page_props = $template->pObj->page_props;
$this->pObj->page_props['BODY'] = $parsed_template;
print_r($this->pObj->page_props);
//$head = $this->head();
return;
}
示例10: detail
function detail()
{
$id = $_GET['id'];
$result_array = $this->connection->db_assoc("SELECT * FROM `RheinaufCMS>BuddyListe` WHERE `id`={$id}");
$page = new Template(INSTALL_PATH . '/Module/BuddyListe/Templates/Detail.template.html');
$vars = $result_array[0];
if ($vars['Bilder']) {
$bilder_array = array();
$bilder_array = explode(';', $vars['Bilder']);
$bilder_string = '';
foreach ($bilder_array as $bild) {
$bilder_string .= '<img src="' . $bild . '" alt="Projektbild" />';
$vars['Bilder'] = $bilder_string;
}
}
return $page->parse_template('TEMPLATE', $vars);
}
示例11: Template
function test_escape()
{
$t = new Template('UTF-8');
$this->assertEquals('one {{ two }} three', $t->parse_template('one \\{{ two \\}} three'));
$this->assertEquals('one {" two "} three', $t->parse_template('one \\{" two \\"} three'));
$this->assertEquals('one {" two "} three', $t->parse_template('one \\{\' two \\\'} three'));
$this->assertEquals('one {% two %} three', $t->parse_template('one \\{% two \\%} three'));
$this->assertEquals('one {! two !} three', $t->parse_template('one \\{! two \\!} three'));
$this->assertEquals('one {# two #} three', $t->parse_template('one \\{# two \\#} three'));
}
示例12: array
function make_table($sql = '', $template = '', $make_template = false)
{
$db_table = $this->table;
$vars = is_array($this->template_vars) ? $this->template_vars : array();
if ($this->edit_enabled) {
if ($_GET['delete']) {
$this->connection->db_query("DELETE FROM `{$db_table}` WHERE `id` = " . $_GET['delete']);
}
}
$order_by = $this->order_by ? $this->order_by : 'id';
$order_dir = $this->order_dir ? $this->order_dir : 'ASC';
$results_per_page = $this->results_per_page ? $this->results_per_page : '';
$start_by = $_GET['start'] ? $_GET['start'] : ($_GET['start'] = 0);
if ($sql == '') {
$sql = "SELECT * FROM `{$db_table}` ORDER BY `{$order_by}` {$order_dir}";
}
if ($results_per_page || $start_by) {
$num_rows = $this->num_rows = $this->connection->db_num_rows($sql);
if (!$results_per_page) {
$results_per_page = $num_rows;
}
$sql .= " LIMIT {$start_by},{$results_per_page}";
}
$result = $this->connection->db_assoc($sql);
if (!$template || $make_template) {
$new_template = '';
$new_template .= "<!--PRE-->\n<table>\n<!--/PRE-->\n<!--LOOP-->\n";
foreach ($this->cols_array as $key => $col) {
$type = $col['type'];
$name = $col['name'];
if ($type != 'ignore' && $type != 'hidden') {
$new_template .= "{IfNotEmpty:{$key}(<tr><td>{$name}</td><td>[{$key}]</td></tr>)}\n";
}
}
$new_template .= "<!--/LOOP-->\n<!--POST-->\n</table>\n<!--/POST-->\n";
if ($make_template) {
RheinaufFile::write_file($template, $new_template);
}
$template = $new_template;
}
$template = new Template($template);
$return_string = '';
$return_string .= $template->parse_template('PRE', $vars);
$alternatig_rows = 0;
foreach ($result as $entry) {
$month = Date::monat($entry['DTSTART']);
if ($month_shown == $month) {
$entry['MONTH_HEAD'] = '';
} else {
$entry['MONTH_HEAD'] = $this->monate[intval($month)] . ' ' . Date::jahr($entry['DTSTART']);
$month_shown = $month;
}
foreach ($entry as $key => $value) {
if (is_array($this->cols_array[$key]['options'])) {
$entry[$key] = $this->cols_array[$key]['options'][$value];
}
if ($this->cols_array[$key]['type'] == 'timestamp') {
$entry[$key] = intval(Date::unify_timestamp($value)) != '0' ? Date::timestamp2datum($value, $this->datumsformat ? $this->datumsformat : 'tag_kurz') : '';
}
if (!$this->cols_array[$key]['html']) {
$entry[$key] = Html::pcdata($entry[$key]);
}
}
if ($this->edit_enabled) {
$icons['edit'] = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/edit.png', '');
$icons['delete'] = Html::img('/' . INSTALL_PATH . '/Classes/Admin/Icons/16x16/cancel.png', '');
$btns['edit'] = Html::a(SELF . '?edit=' . $entry['id'], $icons['edit'], array('title' => 'Eintrag bearbeiten'));
$btns['delete'] = Html::a(SELF . '?delete=' . $entry['id'], $icons['delete'], array('title' => 'Eintrag löschen', 'onclick' => 'return delete_confirm(\'' . $entry['id'] . '\')'));
$entry['edit_btns'] .= implode(' ', $btns);
}
$entry['alt_row'] = ' alt_row_' . $alternatig_rows;
$return_string .= $template->parse_template('LOOP', $entry);
$alternatig_rows = $alternatig_rows == 1 ? 0 : 1;
}
$return_string .= $template->parse_template('POST', $vars);
return $return_string;
}
示例13: stripslashes
<?php
global $spconfig;
$limit = $spconfig['frontpage_popular_Mods_limit'];
$counter = 0;
$ModQuery = $db->Execute("\n SELECT g.id,g.title,p.title AS platform \n FROM Obsedb_Mods AS g, Obsedb_Mods_sections AS p \n WHERE g.section = p.id AND\n g.published = '1'\n ORDER BY g.views DESC\n LIMIT 0,{$limit};");
while ($row = $ModQuery->FetchNextObject()) {
$counter++;
$Mods .= "<div style=\"padding: 3px;\">\n" . " <a href=\"Moddetails.php?id={$row->ID}\"><b>" . stripslashes($row->TITLE) . "</b></a> " . "({$row->PLATFORM})";
}
$frontpagePopularMods = new Template();
$frontpagePopularMods->open_template('frontpage_popular_Mods');
$frontpagePopularMods->addvar('{Mods}', $Mods);
$frontpagePopularMods->parse_template();
$frontpagePopularMods->print_template();
// Clear Mods variable
unset($Mods);
示例14: stripslashes
<?php
// Template Information
// ======================================================================
// This template displays a table of the newest Mods that
// have been added to the site.
//
// You can alter the number of Mods displayed by changing
// the limit in the SQL statement. The default limit is 10.
// ======================================================================
global $spconfig;
$limit = $spconfig['frontpage_latest_Mods_limit'];
$result = $db->Execute("\n SELECT g.id,g.title,p.title AS platform \n FROM Obsedb_Mods AS g, Obsedb_Mods_sections AS p \n WHERE g.section = p.id AND\n g.published = '1'\n ORDER BY `id` DESC\n LIMIT 0,{$limit};");
while ($row = $result->FetchNextObject()) {
$Mods .= "<div style=\"padding: 3px;\">" . "<b><a href=\"Moddetails.php?id={$row->ID}\">" . stripslashes($row->TITLE) . "</a></b> " . "(" . stripslashes($row->PLATFORM) . ")" . "</div>\n";
}
$frontpageLatestMods = new Template();
$frontpageLatestMods->open_template('frontpage_latest_Mods');
$frontpageLatestMods->addvar('{Mods}', $Mods);
$frontpageLatestMods->parse_template();
$frontpageLatestMods->print_template();
unset($Mods);
示例15: unset
$Modlist_header->addvar('{title}', $label_title);
$Modlist_header->addvar('{genre}', $label_genre);
$Modlist_header->addvar('{release}', $label_release);
$Modlist_header->addvar('{section}', $label_section);
$Modlist_header->parse_template();
$Modlist_header->print_template();
unset($Modlist_header);
$Modlist_row = new Template();
$Modlist_row->open_template('Modlist_row');
$result = $db->Execute($sql) or die($db->ErrorMsg());
while ($row = $result->FetchNextObject()) {
$bgcolor = $bgcolor == "#FFFFFF" ? "#E9E9E9" : "#FFFFFF";
$section = stripslashes($sections["{$row->SECTION}"]);
$publisher = stripslashes($companies["{$row->PUBLISHER}"]);
$developer = stripslashes($companies["{$row->DEVELOPER}"]);
$Modlist_row->addvar('{id}', $row->ID);
$Modlist_row->addvar('{title}', stripslashes($row->TITLE));
$Modlist_row->addvar('{bgcolor}', $bgcolor);
$Modlist_row->addvar('{section}', $section);
$Modlist_row->addvar('{genre}', stripslashes($row->GENRE));
$Modlist_row->addvar('{release}', stripslashes($row->RELEASE_DATE));
$Modlist_row->parse_template();
$Modlist_row->print_template();
}
unset($Modlist_row);
$Modlist_footer = new Template();
$Modlist_footer->open_template('Modlist_footer');
$Modlist_footer->print_template();
unset($Modlist_footer);
do_footer();
}