当前位置: 首页>>代码示例>>PHP>>正文


PHP xml::transform方法代码示例

本文整理汇总了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;
}
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:transform.php

示例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;
 }
开发者ID:rair,项目名称:yacs,代码行数:27,代码来源:xml.php


注:本文中的xml::transform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。