本文整理汇总了PHP中xml::transform方法的典型用法代码示例。如果您正苦于以下问题:PHP xml::transform方法的具体用法?PHP xml::transform怎么用?PHP xml::transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xml
的用法示例。
在下文中一共展示了xml::transform方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load_skin
load_skin('tools');
if (!defined('DUMMY_TEXT')) {
define('DUMMY_TEXT', 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.' . ' Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.' . ' Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.' . ' Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.');
}
// the path to this page
$context['path_bar'] = array('tools/' => i18n::s('Tools'));
// populate page attributes -- attributes used by YACS are described in skins/test.php
$context['page_title'] = i18n::s('Hello world');
// $context['navigation'] - navigation boxes
$context['navigation'] .= Skin::build_box(i18n::s('navigation') . ' 1', DUMMY_TEXT, 'navigation');
$context['navigation'] .= Skin::build_box(i18n::s('navigation') . ' 2', DUMMY_TEXT, 'navigation');
// $context['extra'] - extra boxes
$context['extra'] .= Skin::build_box(i18n::s('extra') . ' 1', DUMMY_TEXT, 'extra');
$context['extra'] .= Skin::build_box(i18n::s('extra') . ' 2', DUMMY_TEXT, 'extra');
// $context['page_author'] - the author
$context['page_author'] = 'webmaestro, through some PHP script';
// back to skin index
$context['page_menu'] += array('skins/' => i18n::s('Themes'));
// $context['page_publisher'] - the publisher
$context['page_publisher'] = 'webmaestro again, still through some PHP script';
// $context['path_bar'] - back to other sections
$context['path_bar'] = array('skins/' => i18n::s('Themes'));
// $context['text'] - some text
$context['text'] .= '<p>' . DUMMY_TEXT . '</p>' . '<p>' . DUMMY_TEXT . '</p>' . '<p>' . DUMMY_TEXT . '</p>';
// do the transformation
$data = xml::load_array($context);
$text = xml::transform($data, 'transform.xsl');
// actual transmission except on a HEAD request
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'HEAD') {
echo $text;
}
示例2: transform_file
/**
* transform some XML data
*
* [php]
* $text = xml::transform_file('data.xml', 'template.xsl');
* [/php]
*
* @param string file that contains data
* @param string file that contains XSL declarations
* @return string the resulting XML, or FALSE on error
*/
public static function transform_file($data, $styles)
{
$text = FALSE;
// we need the DOM loader
if (!method_exists('DOMDocument', 'load')) {
return $text;
}
// load data that will be processed
$dom = new DOMDocument();
if (!$dom->load($data)) {
return $text;
}
// do the job
$text = xml::transform($dom, $styles);
return $text;
}