本文整理汇总了PHP中Sections::to_xml方法的典型用法代码示例。如果您正苦于以下问题:PHP Sections::to_xml方法的具体用法?PHP Sections::to_xml怎么用?PHP Sections::to_xml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sections
的用法示例。
在下文中一共展示了Sections::to_xml方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: layout
/**
* list sections
*
* @param resource the SQL result
* @return string the rendered text
*
* @see layouts/layout.php
**/
function layout($result)
{
global $context;
// we return some text
$text = '';
// empty list
if (!SQL::count($result)) {
return $text;
}
// process all items in the list
while ($item = SQL::fetch($result)) {
// get the related overlay
$overlay = Overlay::load($item, 'section:' . $item['id']);
// more text
$text .= Sections::to_xml($item, $overlay);
}
// end of processing
SQL::free($result);
return $text;
}
示例2: elseif
include '../error.php';
// permission denied
} elseif (!Sections::allow_access($item, $anchor)) {
// anonymous users are invited to log in or to register
if (!Surfer::is_logged()) {
Safe::redirect($context['url_to_home'] . $context['url_to_root'] . 'users/login.php?url=' . urlencode(Sections::get_url($item['id'], 'export')));
}
// permission denied to authenticated user
Safe::header('Status: 401 Unauthorized', TRUE, 401);
Logger::error(i18n::s('You are not allowed to perform this operation.'));
// display the article
} else {
// file header
$text = '<?xml version="1.0" encoding="' . $context['charset'] . '"?>' . "\n" . '<content>' . "\n";
// item actual content
$text .= Sections::to_xml($item, $overlay);
$text .= "\n" . '</content>';
//
// transfer to the user agent
//
// handle the output correctly
render_raw('text/xml; charset=' . $context['charset']);
// suggest a name on download
if (!headers_sent()) {
$file_name = utf8::to_ascii(Skin::strip($context['page_title']) . '.xml');
Safe::header('Content-Disposition: attachment; filename="' . str_replace('"', '', $file_name) . '"');
}
// enable 30-minute caching (30*60 = 1800), even through https, to help IE6 on download
http::expire(1800);
// strong validator
$etag = '"' . md5($text) . '"';