本文整理汇总了PHP中HTML_Template_Flexy::getElements方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_Template_Flexy::getElements方法的具体用法?PHP HTML_Template_Flexy::getElements怎么用?PHP HTML_Template_Flexy::getElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_Template_Flexy
的用法示例。
在下文中一共展示了HTML_Template_Flexy::getElements方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setVariables
/**
* テンプレートの設定
* @param $templateName
* @access private
*/
protected function setVariables($templateName, $obj)
{
// Hidden値の設定
// Flexyを生成する前に $this->_hidden に値を代入しておく
// Flexyから $this->_hidden が利用される
$hidden = Container::getInstance()->getComponent('Laiz_Action_Component_Hidden');
if ($hidden instanceof Laiz_Action_Component_Hidden) {
foreach ($hidden->getHiddens() as $key => $value) {
if (is_array($value)) {
foreach ($value as $hiddenName => $hiddenValue) {
$this->setHidden($key, $hiddenName, $hiddenValue);
}
}
}
}
$options = array('templateDir' => $this->TEMPLATE_DIR, 'multiSource' => true, 'compileDir' => $this->FLEXY_COMPILE_DIR, 'numberFormat' => ', 0', 'forceCompile' => $this->FLEXY_FORCE_COMPILE);
// ユーザ独自の設定
if ($this->_flexyOptions) {
$options = array_merge($options, $this->_flexyOptions);
}
$rep = error_reporting();
error_reporting($rep & E_ALL);
// PEARの関係上Strictエラーを除外する
$this->flexy = new Fly_Flexy($options);
// Hidden値の設定
//$this->flexy->setHiddens($this->_hiddens);
$this->flexy->compile($templateName);
$this->_elements = $this->flexy->getElements();
error_reporting($rep);
$this->_setVariables($obj);
$this->_obj = $obj;
}
示例2: compilefile
function compilefile($file, $data = array(), $options = array(), $elements = array())
{
$options = $options + array('templateDir' => dirname(__FILE__) . '/templates', 'forceCompile' => true, 'fatalError' => HTML_TEMPLATE_FLEXY_ERROR_RETURN, 'url_rewrite' => 'images/:/myproject/images/', 'compileDir' => dirname(__FILE__) . '/results1');
// basic options..
echo "\n\n===Compiling {$file}===\n\n";
$options['compileDir'] = dirname(__FILE__) . '/results1';
$x = new HTML_Template_Flexy($options);
$res = $x->compile($file);
if ($res !== true) {
echo "===Compile failure==\n" . $res->toString() . "\n";
return;
}
echo "\n\n===Compiled file: {$file}===\n";
echo file_get_contents($x->compiledTemplate);
if (!empty($options['show_elements'])) {
print_r($x->getElements());
}
if (!empty($options['show_words'])) {
print_r(unserialize(file_get_contents($x->gettextStringsFile)));
}
echo "\n\n===With data file: {$file}===\n";
$data = (object) $data;
$x->outputObject($data, $elements);
}
示例3: array
}
}
}
}
// }}}
// {{{ output
$_flexy_options = array('locale' => 'ja', 'charset' => 'Shift_JIS', 'compileDir' => $_conf['compile_dir'] . DIRECTORY_SEPARATOR . 'ic2', 'templateDir' => P2EX_LIB_DIR . '/ic2/templates', 'numberFormat' => '');
$flexy = new HTML_Template_Flexy($_flexy_options);
$flexy->compile('ic2s.tpl.html');
if (!$isPopUp && (!empty($upfiles) || P2Util::hasInfoHtml())) {
$showForm = false;
} else {
$showForm = true;
}
// フォームを修正
$elements = $flexy->getElements();
if ($showForm) {
$form_attr = array('action' => $_SERVER['SCRIPT_NAME'] . '?upload=1', 'accept-charset' => $_conf['accept_charset']);
$elements['fileupload']->setAttributes($form_attr);
$elements['MAX_FILE_SIZE']->setValue($maxsize);
$elements['popup']->setValue($isPopUp);
if ($isPopUp) {
$elements['fileupload']->setAttributes('target="_self"');
} else {
$elements['fileupload']->setAttributes('target="read"');
}
}
// テンプレート変数
$view = new stdClass();
$view->php_self = $_SERVER['SCRIPT_NAME'];
$view->STYLE = $STYLE;