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


PHP OC_Template::append方法代码示例

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


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

示例1: compareEntries

<?php

/**
 * Copyright (c) 2011, Robin Appelman <icewind1991@gmail.com>
 * This file is licensed under the Affero General Public License version 3 or later.
 * See the COPYING-README file.
 */
require_once '../lib/base.php';
OC_Util::checkAdminUser();
OC_Util::addStyle("settings", "settings");
OC_Util::addScript("settings", "admin");
OC_Util::addScript("settings", "log");
OC_App::setActiveNavigationEntry("admin");
$tmpl = new OC_Template('settings', 'admin', 'user');
$forms = OC_App::getForms('admin');
$entries = OC_Log_Owncloud::getEntries(3);
function compareEntries($a, $b)
{
    return $b->time - $a->time;
}
usort($entries, 'compareEntries');
$tmpl->assign('loglevel', OC_Config::getValue("loglevel", 2));
$tmpl->assign('entries', $entries);
$tmpl->assign('forms', array());
foreach ($forms as $form) {
    $tmpl->append('forms', $form);
}
$tmpl->printPage();
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:28,代码来源:admin.php

示例2: fetchPage

 /**
  * @brief Proceeds the template
  * @returns content
  *
  * This function proceeds the template. If $this->renderas is set, it will
  * will produce a full page.
  */
 public function fetchPage()
 {
     $data = $this->_fetch();
     if ($this->renderas) {
         // Decide which page we show
         if ($this->renderas == "user") {
             $page = new OC_Template("core", "layout.user");
             $page->assign('searchurl', OC_Helper::linkTo('search', 'index.php'));
             if (array_search(OC_APP::getCurrentApp(), array('settings', 'admin', 'help')) !== false) {
                 $page->assign('bodyid', 'body-settings');
             } else {
                 $page->assign('bodyid', 'body-user');
             }
             // Add navigation entry
             $page->assign("navigation", OC_App::getNavigation());
             $page->assign("settingsnavigation", OC_App::getSettingsNavigation());
         } else {
             $page = new OC_Template("core", "layout.guest");
         }
         // Add the css and js files
         foreach (OC_Util::$scripts as $script) {
             if (is_file(OC::$SERVERROOT . "/apps/{$script}.js")) {
                 $page->append("jsfiles", OC::$WEBROOT . "/apps/{$script}.js");
             } elseif (is_file(OC::$SERVERROOT . "/{$script}.js")) {
                 $page->append("jsfiles", OC::$WEBROOT . "/{$script}.js");
             } else {
                 $page->append("jsfiles", OC::$WEBROOT . "/core/{$script}.js");
             }
         }
         foreach (OC_Util::$styles as $style) {
             if (is_file(OC::$SERVERROOT . "/apps/{$style}.css")) {
                 $page->append("cssfiles", OC::$WEBROOT . "/apps/{$style}.css");
             } elseif (is_file(OC::$SERVERROOT . "/{$style}.css")) {
                 $page->append("cssfiles", OC::$WEBROOT . "/{$style}.css");
             } else {
                 $page->append("cssfiles", OC::$WEBROOT . "/core/{$style}.css");
             }
         }
         // Add custom headers
         $page->assign('headers', $this->headers);
         foreach (OC_Util::$headers as $header) {
             $page->append('headers', $header);
         }
         // Add css files and js files
         $page->assign("content", $data);
         return $page->fetchPage();
     } else {
         return $data;
     }
 }
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:57,代码来源:owncloud_lib_template.php

示例3: printSongs

 private function printSongs($songs, $artistName = false, $albumName = false)
 {
     header('Content-Type:  text/xml');
     $tmpl = new \OC_Template('media', 'ampache/songs');
     foreach ($songs as $song) {
         $songData = array();
         if ($artistName) {
             $songData['artist_name'] = xmlentities($artistName);
         } else {
             $songData['artist_name'] = xmlentities($this->collection->getArtistName($song['song_artist']));
         }
         if ($albumName) {
             $songData['album_name'] = xmlentities($albumName);
         } else {
             $songData['album_name'] = xmlentities($this->collection->getAlbumName($song['song_album']));
         }
         $songData['id'] = $song['song_id'];
         $songData['name'] = xmlentities($song['song_name']);
         $songData['artist'] = $song['song_artist'];
         $songData['album'] = $song['song_album'];
         $songData['length'] = $song['song_length'];
         $songData['track'] = $song['song_track'];
         $songData['size'] = $song['song_size'];
         $url = \OCP\Util::linkToRemote('ampache') . 'server/xml.server.php/?action=play&song=' . $songData['id'] . '&auth=' . $_GET['auth'];
         $songData['url'] = xmlentities($url);
         $tmpl->append('songs', $songData);
     }
     $tmpl->printPage();
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:29,代码来源:ampache.php

示例4: fetchPage

 /**
  * @brief Proceeds the template
  * @returns content
  *
  * This function proceeds the template. If $this->renderas is set, it
  * will produce a full page.
  */
 public function fetchPage()
 {
     $data = $this->_fetch();
     if ($this->renderas) {
         // Decide which page we show
         if ($this->renderas == "user") {
             $page = new OC_Template("core", "layout.user");
             $page->assign('searchurl', OC_Helper::linkTo('search', 'index.php'));
             if (array_search(OC_APP::getCurrentApp(), array('settings', 'admin', 'help')) !== false) {
                 $page->assign('bodyid', 'body-settings');
             } else {
                 $page->assign('bodyid', 'body-user');
             }
             // Add navigation entry
             $navigation = OC_App::getNavigation();
             $page->assign("navigation", $navigation);
             $page->assign("settingsnavigation", OC_App::getSettingsNavigation());
             foreach ($navigation as $entry) {
                 if ($entry['active']) {
                     $page->assign('application', $entry['name']);
                     break;
                 }
             }
         } else {
             $page = new OC_Template("core", "layout.guest");
         }
         // Read the selected theme from the config file
         $theme = OC_Config::getValue("theme");
         // Read the detected formfactor and use the right file name.
         $fext = $this->getFormFactorExtension();
         // Add the core js files or the js files provided by the selected theme
         foreach (OC_Util::$scripts as $script) {
             // Is it in 3rd party?
             if ($page->appendIfExist('jsfiles', OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $script . '.js')) {
                 // Is it in apps and overwritten by the theme?
             } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/apps/{$script}{$fext}.js")) {
             } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/apps/{$script}.js")) {
                 // Is it part of an app?
             } elseif ($page->appendIfExist('jsfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/{$script}{$fext}.js")) {
             } elseif ($page->appendIfExist('jsfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/{$script}.js")) {
                 // Is it in the owncloud root but overwritten by the theme?
             } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/{$script}{$fext}.js")) {
             } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/{$script}.js")) {
                 // Is it in the owncloud root ?
             } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "{$script}{$fext}.js")) {
             } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "{$script}.js")) {
                 // Is in core but overwritten by a theme?
             } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/core/{$script}{$fext}.js")) {
             } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/core/{$script}.js")) {
                 // Is it in core?
             } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/{$script}{$fext}.js")) {
             } elseif ($page->appendIfExist('jsfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/{$script}.js")) {
             } else {
                 echo 'js file not found: script:' . $script . ' formfactor:' . $fext . ' webroot:' . OC::$WEBROOT . ' serverroot:' . OC::$SERVERROOT;
                 die;
             }
         }
         // Add the css files
         foreach (OC_Util::$styles as $style) {
             // is it in 3rdparty?
             if ($page->appendIfExist('cssfiles', OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $style . '.css')) {
                 // or in apps?
             } elseif ($page->appendIfExist('cssfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/{$style}{$fext}.css")) {
             } elseif ($page->appendIfExist('cssfiles', OC::$APPSROOT, OC::$APPSWEBROOT, "apps/{$style}.css")) {
                 // or in the owncloud root?
             } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "{$style}{$fext}.css")) {
             } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "{$style}.css")) {
                 // or in core ?
             } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/{$style}{$fext}.css")) {
             } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "core/{$style}.css")) {
             } else {
                 echo 'css file not found: style:' . $script . ' formfactor:' . $fext . ' webroot:' . OC::$WEBROOT . ' serverroot:' . OC::$SERVERROOT;
                 die;
             }
         }
         // Add the theme css files. you can override the default values here
         if (!empty($theme)) {
             foreach (OC_Util::$styles as $style) {
                 if ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/apps/{$style}{$fext}.css")) {
                 } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/apps/{$style}.css")) {
                 } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/{$style}{$fext}.css")) {
                 } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/{$style}.css")) {
                 } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/core/{$style}{$fext}.css")) {
                 } elseif ($page->appendIfExist('cssfiles', OC::$SERVERROOT, OC::$WEBROOT, "themes/{$theme}/core/{$style}.css")) {
                 }
             }
         }
         // Add custom headers
         $page->assign('headers', $this->headers);
         foreach (OC_Util::$headers as $header) {
             $page->append('headers', $header);
         }
         // Add css files and js files
//.........这里部分代码省略.........
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:101,代码来源:template.php


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