本文整理匯總了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) . '"';