本文整理汇总了PHP中template::parse_loop方法的典型用法代码示例。如果您正苦于以下问题:PHP template::parse_loop方法的具体用法?PHP template::parse_loop怎么用?PHP template::parse_loop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类template
的用法示例。
在下文中一共展示了template::parse_loop方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reset
$tpl->load_file($tplt, $path['templates'] . $tmpl['layout']);
/*****************************************************
** Register language file and additional text array
*****************************************************/
if (isset($txt) and is_array($txt)) {
reset($txt);
while (list($key, $val) = each($txt)) {
${$key} = $val;
$tpl->register($tplt, $key);
}
}
if (isset($add_text) and is_array($add_text)) {
reset($add_text);
while (list($key, $val) = each($add_text)) {
${$key} = $val;
$tpl->register($tplt, $key);
}
}
/*****************************************************
** Parse template
*****************************************************/
$tpl->register($tplt, array('bar_image_name', 'document_self', 'intern_vote_name', 'max_bar_width', 'rating', 'rating_image', 'script_self', 'total_votes', 'vote_form_fields', 'vote_text', 'vote_title', 'captcha_content', 'email_address'));
$tpl->parse_if($tplt, 'display_form');
$tpl->parse_if($tplt, 'display_results');
$tpl->parse_if($tplt, 'display_link');
$tpl->parse_if($tplt, 'display_email');
$tpl->parse_if($tplt, 'display_captcha');
$tpl->parse_loop($tplt, 'vote_result');
$tpl->parse_loop($tplt, 'message');
@eval($conf_var);
debug_mode(script_runtime($runtime_start), 'Script Runtime');
示例2: reset
} else {
/*****************************************************
** Parse global template (mostly for user debugging)
*****************************************************/
if (isset($add_text) and is_array($add_text)) {
reset($add_text);
foreach ($add_text as $key => $val) {
${$key} = $val;
$tpl->register('dlcl', $key);
}
}
$txt['txt_script_version'] = $script_version;
if (!isset($show_error_messages) or $show_error_messages != 'yes') {
unset($system_message);
$system_message = array();
$txt['txt_system_message'] = '';
} else {
$system_message[] = array('message' => $txt['txt_set_off_note']);
$system_message[] = array('message' => $txt['txt_problems']);
}
if (isset($txt) and is_array($txt)) {
reset($txt);
foreach ($txt as $key => $val) {
${$key} = $val;
$tpl->register('dlcl', $key);
}
}
$tpl->parse_loop('dlcl', 'system_message');
@eval($parse_template);
}
debug_mode(script_runtime($runtime_start), 'Script Runtime');
示例3: template
/*****************************************************
** Load template
*****************************************************/
$tpl = new template();
$tpl->load_file('global', './templates/test.tpl.html');
/*****************************************************
** Parse global template (mostly for user debugging)
*****************************************************/
if (isset($add_text) and is_array($add_text)) {
reset($add_text);
foreach ($add_text as $key => $val) {
${$key} = $val;
$tpl->register('global', $key);
}
}
if (isset($extension_list) and !empty($extension_list) and is_array($extension_list)) {
for ($i = 0; $i < count($extension_list); $i++) {
$extensions[] = array('EXT' => strtoupper($extension_list[$i]), 'ext' => strtolower($extension_list[$i]));
}
}
$tpl->parse_loop('global', 'system_message');
$tpl->parse_loop('global', 'extensions');
if (isset($txt) and is_array($txt)) {
reset($txt);
foreach ($txt as $key => $val) {
${$key} = $val;
$tpl->register('global', $key);
}
}
$tpl->parse('global');
$tpl->print_file('global');
示例4: array
** Filename.....: seperate-script.php
** Author.......: Richard Heyes
** Version......: 1.0
** Notes........: This shows how you can
** use multiple template files.
** Last changed.: 23/05/00
** Last change..:
***************************************/
include 'class.template.inc';
/***************************************
** Set a couple of example variables.
***************************************/
$test_var = 'Hello world!';
$page_title = 'Template Class';
/***************************************
** Set a couple of example arrays.
***************************************/
$table_rows = array();
$table_rows[] = array('column_1' => 'This is column one on row one!', 'column_2' => 'This is column two on row one!', 'column_3' => 'This is column three on row one!');
$table_rows[] = array('column_1' => 'This is column one on row two!', 'column_2' => 'This is column two on row two!', 'column_3' => 'This is column three on row two!');
/***************************************
** The template goodies.
***************************************/
$tpl = new template();
$tpl->load_file('header', 'header-template.html');
$tpl->load_file('main', 'main-template.html');
$tpl->load_file('footer', 'footer-template.html');
$tpl->register('header', 'test_var, page_title');
$tpl->parse('header, main, footer');
$tpl->parse_loop('main', 'table_rows');
$tpl->print_file('header, main, footer');
示例5: array
$table_rows[] = array('column_1' => 'This is column one on row two!', 'column_2' => 'This is column two on row two!', 'column_3' => 'This is column three on row two!');
/***************************************
** Postgres stuff. This was the code I
** used to test the $obj->parse_pgsql()
** method. Worked too.
***************************************/
/*
$pg = pg_connect('user=richard dbname=scripts port=5432');
$sqlquery = 'SELECT col1 AS column_1, col2 AS column_2, col3 AS column_3 FROM test';
$table_rows = pg_exec($pg, $sqlquery);
*/
/***************************************
** The template goodies, using shortcut
** functions.
***************************************/
$tpl = new template();
$tpl->load_file('complete', 'complete-template.html');
$tpl->parse_loop('complete', 'table_rows');
$tpl->pprint('complete', array('test_var', 'page_title'));
/***************************************
** The template goodies, using the
** longer method.
***************************************/
/*
$tpl->load_file('complete', 'complete-template.html');
$tpl->register('complete', 'test_var,page_title');
$tpl->parse('complete');
$tpl->parse_loop('complete', 'table_rows');
$tpl->print_file('complete');
*/
示例6: template
<?php
include 'tplutil.inc';
include 'class.template.inc';
$GLOBALS['TITLE'] = 'My Title';
$GLOBALS['USER'] = get_user();
$GLOBALS['users'] = get_users(true);
$tpl = new template();
$tpl->load_file('main', 'slides/pragmatic/templateclass.tpl');
$tpl->parse_loop('main', 'users');
$tpl->pprint('main', array('USER', 'TITLE'));