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


PHP XMLElement::setDTD方法代码示例

本文整理汇总了PHP中XMLElement::setDTD方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLElement::setDTD方法的具体用法?PHP XMLElement::setDTD怎么用?PHP XMLElement::setDTD使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XMLElement的用法示例。


在下文中一共展示了XMLElement::setDTD方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: view

 function view()
 {
     // fetch all pages
     $pages = PageManager::fetch();
     // build container DIV
     $sitemap = new XMLElement('div', null, array('class' => 'sitemap'));
     // add headings
     $sitemap->appendChild(new XMLElement('h1', 'Sitemap <span>' . Symphony::Configuration()->get('sitename', 'general') . '</span>'));
     $sitemap->appendChild(new XMLElement('h2', 'Site Map, ' . date('d F Y', time())));
     // build container ULs
     $primary = new XMLElement('ul', null, array('id' => 'primaryNav'));
     $utilities = new XMLElement('ul', null, array('id' => 'utilityNav'));
     // get values from config: remove spaces, remove any trailing commas and split into an array
     $this->type_index = explode(',', trim(preg_replace('/ /', '', Symphony::Configuration()->get('index_type', 'sitemap')), ','));
     $this->type_primary = explode(',', trim(preg_replace('/ /', '', Symphony::Configuration()->get('primary_type', 'sitemap')), ','));
     $this->type_utility = explode(',', trim(preg_replace('/ /', '', Symphony::Configuration()->get('utilities_type', 'sitemap')), ','));
     $this->type_exclude = explode(',', trim(preg_replace('/ /', '', Symphony::Configuration()->get('exclude_type', 'sitemap')), ','));
     // supplement list of pages with additional meta data
     foreach ($pages as $page) {
         $page['url'] = '/' . implode('/', Administration::instance()->resolvePagePath($page['id']));
         $page['edit-url'] = Administration::instance()->getCurrentPageURL() . 'edit/' . $page['id'] . '/';
         if (count(array_intersect($page['type'], $this->type_exclude)) > 0) {
             continue;
         }
         $page['is_home'] = count(array_intersect($page['type'], $this->type_index)) ? true : false;
         $page['is_primary'] = count(array_intersect($page['type'], $this->type_primary)) > 0 ? true : false;
         $page['is_utility'] = count(array_intersect($page['type'], $this->type_utility)) > 0 ? true : false;
         $this->_pages[] = $page;
     }
     // append the Home page first
     foreach ($this->_pages as $page) {
         if ($page['is_home'] == true) {
             $this->appendPage($primary, $page, 1, true, false);
         }
     }
     // append top level pages
     $primary_pages = 0;
     foreach ($this->_pages as $page) {
         if ($page['is_primary'] == true) {
             $primary_pages++;
             $this->appendPage($primary, $page);
         }
     }
     // sitemap provides styles for up to 10 top level pages
     if ($primary_pages > 0 && $primary_pages < 11) {
         $primary->setAttribute('class', 'col' . $primary_pages);
     }
     // append utilities (global) pages
     foreach ($this->_pages as $page) {
         if ($page['is_utility'] == true) {
             $this->appendPage($utilities, $page, 1, false, false);
         }
     }
     if ($utilities->getNumberOfChildren() > 0) {
         $sitemap->appendChild($utilities);
     }
     $sitemap->appendChild($primary);
     // build a vanilla HTML document
     $html = new XMLElement('html');
     $html->setDTD('<!DOCTYPE html>');
     $head = new XMLElement('head');
     $head->appendChild(new XMLElement('meta', null, array('charset' => 'utf-8')));
     $head->appendChild(new XMLElement('title', 'Site Map — ' . Symphony::Configuration()->get('sitename', 'general')));
     $head->appendChild(new XMLElement('link', null, array('rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'print, screen', 'href' => URL . '/extensions/sitemap/assets/sitemap.map.css')));
     $head->appendChild(new XMLElement('link', null, array('rel' => 'stylesheet', 'type' => 'text/css', 'media' => 'print, screen', 'href' => URL . '/extensions/sitemap/assets/slickmap/slickmap.css')));
     $html->appendChild($head);
     $body = new XMLElement('body');
     $body->appendChild($sitemap);
     $html->appendChild($body);
     header('content-type: text/html');
     echo $html->generate(true);
     die;
 }
开发者ID:symphonists,项目名称:sitemap,代码行数:73,代码来源:content.map.php


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