本文整理汇总了PHP中jTpl::meta方法的典型用法代码示例。如果您正苦于以下问题:PHP jTpl::meta方法的具体用法?PHP jTpl::meta怎么用?PHP jTpl::meta使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jTpl
的用法示例。
在下文中一共展示了jTpl::meta方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContent
/**
* get the zone content
* Return the cache content if it is activated and if it's exists, or call _createContent
* @return string zone content
*/
public function getContent()
{
global $gJConfig;
if ($this->_useCache && !$gJConfig->zones['disableCache']) {
$f = $this->_getCacheFile();
if (file_exists($f)) {
if ($this->_cacheTimeout > 0) {
#if PHP53ORMORE
clearstatcache(false, $f);
#else
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
clearstatcache(false, $f);
} else {
clearstatcache();
}
#endif
if (time() - filemtime($f) > $this->_cacheTimeout) {
// timeout : regenerate the cache
unlink($f);
$this->_cancelCache = false;
$content = $this->_createContent();
if (!$this->_cancelCache) {
jFile::write($f, $content);
}
return $content;
}
}
if ($this->_tplname != '') {
$this->_tpl = new jTpl();
$this->_tpl->assign($this->_params);
$this->_tpl->meta($this->_tplname, $this->_tplOuputType);
}
$content = file_get_contents($f);
} else {
$this->_cancelCache = false;
$content = $this->_createContent();
if (!$this->_cancelCache) {
jFile::write($f, $content);
}
}
} else {
$content = $this->_createContent();
}
return $content;
}
示例2: output
/**
* output the html content
*
* @return boolean true if the generated content is ok
*/
public function output()
{
if ($this->_outputOnlyHeaders) {
$this->sendHttpHeaders();
return true;
}
foreach ($this->plugins as $name => $plugin) {
$plugin->afterAction();
}
$this->doAfterActions();
$this->setContentType();
// let's get the main content for the body
// we don't output yet <head> and other things, to have the
// opportunity for any components called during the output,
// to add things in the <head>
if ($this->bodyTpl != '') {
$this->body->meta($this->bodyTpl);
$content = $this->body->fetch($this->bodyTpl, 'html', true, false);
} else {
$content = '';
}
// retrieve errors messages and log messages
jLog::outputLog($this);
foreach ($this->plugins as $name => $plugin) {
$plugin->beforeOutput();
}
// now let's output the html content
$this->sendHttpHeaders();
$this->outputDoctype();
$this->outputHtmlHeader();
echo '<body ';
foreach ($this->bodyTagAttributes as $attr => $value) {
echo $attr, '="', htmlspecialchars($value), '" ';
}
echo ">\n";
echo implode("\n", $this->_bodyTop);
echo $content;
echo implode("\n", $this->_bodyBottom);
foreach ($this->plugins as $name => $plugin) {
$plugin->atBottom();
}
echo '</body></html>';
return true;
}
示例3: output
/**
* generate the xul content.
* @return boolean true if it's ok
*/
public function output()
{
$this->doAfterActions();
if ($this->bodyTpl != '') {
$this->body->meta($this->bodyTpl);
$content = $this->body->fetch($this->bodyTpl);
} else {
$content = '';
}
// retrieve errors messages and log messages
jLog::outputLog($this);
$this->_httpHeaders['Content-Type'] = 'application/vnd.mozilla.xul+xml;charset=' . $GLOBALS['gJConfig']->charset;
$this->sendHttpHeaders();
$this->outputHeader();
echo implode('', $this->_bodyTop);
echo $content;
echo implode('', $this->_bodyBottom);
echo '</', $this->_root, '>';
return true;
}
示例4: output
/**
* generate the xul content.
* @return boolean true if it's ok
*/
public function output()
{
$this->_headSent = false;
$this->_httpHeaders['Content-Type'] = 'application/vnd.mozilla.xul+xml;charset=' . $GLOBALS['gJConfig']->charset;
$this->sendHttpHeaders();
$this->doAfterActions();
if ($this->bodyTpl != '') {
$this->body->meta($this->bodyTpl);
}
$this->outputHeader();
$this->_headSent = true;
echo implode('', $this->_bodyTop);
if ($this->bodyTpl != '') {
$this->body->display($this->bodyTpl);
}
if ($this->hasErrors()) {
if ($GLOBALS['gJConfig']->error_handling['showInFirebug']) {
echo '<script type="text/javascript">if(console){';
foreach ($GLOBALS['gJCoord']->errorMessages as $e) {
switch ($e[0]) {
case 'warning':
echo 'console.warn("[warning ';
break;
case 'notice':
echo 'console.info("[notice ';
break;
case 'strict':
echo 'console.info("[strict ';
break;
case 'error':
echo 'console.error("[error ';
break;
}
echo $e[1], '] ', str_replace(array('"', "\n", "\r", "\t"), array('\\"', '\\n', '\\r', '\\t'), $e[2]), ' (', str_replace('\\', '\\\\', $e[3]), ' ', $e[4], ')");';
}
echo '}else{alert("there are some errors, you should activate Firebug to see them");}</script>';
} else {
echo '<vbox id="jelixerror" style="border:3px solid red; background-color:#f39999;color:black;">';
echo $this->getFormatedErrorMsg();
echo '</vbox>';
}
}
echo implode('', $this->_bodyBottom);
if (count($GLOBALS['gJCoord']->logMessages)) {
if (count($GLOBALS['gJCoord']->logMessages['response'])) {
echo '<vbox id="jelixlog">';
foreach ($GLOBALS['gJCoord']->logMessages['response'] as $m) {
echo '<description>', htmlspecialchars($m), '</description>';
}
echo '</vbox>';
}
if (count($GLOBALS['gJCoord']->logMessages['firebug'])) {
echo '<script type="text/javascript">if(console){';
foreach ($GLOBALS['gJCoord']->logMessages['firebug'] as $m) {
echo 'console.debug("', str_replace(array('"', "\n", "\r", "\t"), array('\\"', '\\n', '\\r', '\\t'), $m), '");';
}
echo '}else{alert("there are log messages, you should activate Firebug to see them");}</script>';
}
}
echo '</', $this->_root, '>';
return true;
}
示例5: output
/**
* output the html content
*
* @return boolean true if the generated content is ok
*/
public final function output()
{
$this->_headSent = 0;
if ($this->_isXhtml && $this->xhtmlContentType && strstr($_SERVER['HTTP_ACCEPT'], 'application/xhtml+xml')) {
$this->_httpHeaders['Content-Type'] = 'application/xhtml+xml;charset=' . $this->_charset;
} else {
$this->_httpHeaders['Content-Type'] = 'text/html;charset=' . $this->_charset;
}
$this->sendHttpHeaders();
$this->outputDoctype();
$this->_headSent = 1;
$this->doAfterActions();
if ($this->bodyTpl != '') {
$this->body->meta($this->bodyTpl);
}
$this->outputHtmlHeader();
echo '<body ';
foreach ($this->bodyTagAttributes as $attr => $value) {
echo $attr, '="', htmlspecialchars($value), '" ';
}
echo ">\n";
$this->_headSent = 2;
echo implode("\n", $this->_bodyTop);
if ($this->bodyTpl != '') {
$this->body->display($this->bodyTpl);
}
if ($this->hasErrors()) {
if ($GLOBALS['gJConfig']->error_handling['showInFirebug']) {
echo '<script type="text/javascript">if(console){';
foreach ($GLOBALS['gJCoord']->errorMessages as $e) {
switch ($e[0]) {
case 'warning':
echo 'console.warn("[warning ';
break;
case 'notice':
echo 'console.info("[notice ';
break;
case 'strict':
echo 'console.info("[strict ';
break;
case 'error':
echo 'console.error("[error ';
break;
}
echo $e[1], '] ', str_replace(array('"', "\n", "\r", "\t"), array('\\"', '\\n', '\\r', '\\t'), $e[2]), ' (', str_replace('\\', '\\\\', $e[3]), ' ', $e[4], ')");';
}
echo '}else{alert("there are some errors, you should activate Firebug to see them");}</script>';
} else {
echo '<div id="jelixerror" style="position:absolute;left:0px;top:0px;border:3px solid red; background-color:#f39999;color:black;">';
echo $this->getFormatedErrorMsg();
echo '<p><a href="#" onclick="document.getElementById(\'jelixerror\').style.display=\'none\';return false;">fermer</a></p></div>';
}
}
echo implode("\n", $this->_bodyBottom);
if (count($GLOBALS['gJCoord']->logMessages)) {
if (count($GLOBALS['gJCoord']->logMessages['response'])) {
echo '<ul id="jelixlog">';
foreach ($GLOBALS['gJCoord']->logMessages['response'] as $m) {
echo '<li>', htmlspecialchars($m), '</li>';
}
echo '</ul>';
}
if (count($GLOBALS['gJCoord']->logMessages['firebug'])) {
echo '<script type="text/javascript">if(console){';
foreach ($GLOBALS['gJCoord']->logMessages['firebug'] as $m) {
echo 'console.debug("', str_replace(array('"', "\n", "\r", "\t"), array('\\"', '\\n', '\\r', '\\t'), $m), '");';
}
echo '}else{alert("there are log messages, you should activate Firebug to see them");}</script>';
}
}
echo '</body></html>';
return true;
}
示例6: testIncludeRecursive
function testIncludeRecursive()
{
// when a template includes itself, meta should be retrieved only one time
// to avoid infinite loop
$tpl = new jTpl();
$tpl->assign('items', array(1, 2));
$meta = $tpl->meta('test_include_recursive');
$content = $tpl->fetch('test_include_recursive');
$this->assertEqual(array('main' => '2', 'counter' => 1), $meta);
$this->assertEqualOrDiff("c=2\nx=2\nc=1\nx=1\n", $content);
// if a template includes an other template more than one time,
// meta should be retrieved only one time
$tpl = new jTpl();
$tpl->assign('items', array());
$meta = $tpl->meta('test_include_recursive2');
$content = $tpl->fetch('test_include_recursive2');
$this->assertEqual(array('main' => '0', 'counter' => 1), $meta);
$this->assertEqualOrDiff("c=2\nx=2\nc=1\nx=1\nc=2\nx=4\nc=1\nx=3\n\n", $content);
}