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


PHP TPL::assignAsLoop方法代码示例

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


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

示例1: fetchPosts

 private function fetchPosts($paginationObject, $category_slug = false, $browser = true)
 {
     $posts = new TPLLoop(TPL_LOOP_BLOG_POSTS);
     foreach ($paginationObject->fetch() as $post) {
         $i = new TPLLoopItem();
         $i->add('POST_LINK', str_replace(array('%slug', '%id'), array($post->post_slug, $post->post_id), CFG_URL_BLOG_POST));
         $i->add('CATEGORY_LINK', str_replace(array('%slug', '%id'), array($post->category_slug, $post->category_id), CFG_URL_BLOG_CATEGORY));
         $i->add('POST_ID', $post->post_id);
         $i->add('POST_SLUG', $post->post_slug);
         $i->add('POST_HEADER', $post->post_header);
         $i->add('POST_DATE', date(ESCMS_DATE_FORMAT, (int) $post->post_date));
         $i->add('POST_PROLOGUE', $post->post_prologue);
         $i->add('CATEGORY_ID', $post->category_id);
         $i->add('CATEGORY_SLUG', $post->category_slug);
         $i->add('CATEGORY_HEADER', $post->category_header);
         $i->add('COMMENTS_COUNT', $post->comments_count);
         $posts->append($i);
     }
     $posts->pack();
     if ($browser) {
         TPL::assignAsLoop(TPL_LOOP_BLOG_BROWSER, $paginationObject->getBrowser());
     }
 }
开发者ID:jankuca,项目名称:escms,代码行数:23,代码来源:blog.mod.php

示例2: make

 public function make()
 {
     TPL::assignAsLoop($this->loopKey, $this->items);
 }
开发者ID:jankuca,项目名称:smog-cms,代码行数:4,代码来源:menu.mod.php

示例3: _module_config_load

 public function _module_config_load()
 {
     $cfg = core::s('cfg');
     TPL::add('SITE_TITLE', '{L_SITE_CONFIG} — {SITE_HEADER} / {L_ACP}');
     $sql = new SQLObject();
     if ($sql->query("\r\nSELECT module,name,value,type\r\nFROM " . $sql->table('config') . "\r\nWHERE (module = 'core')")) {
         foreach ($sql->fetch() as $item) {
             switch ($item->type) {
                 case 'integer':
                     $value = (int) $item->value;
                     break;
                 case 'string':
                     $value = (string) $item->value;
                     break;
                 case 'float':
                     $value = (double) $item->value;
                     break;
                 case 'timestamp':
                     $value = strtotime((string) $item->value);
                     break;
                 case 'boolean':
                     if ((int) $item->value == 0) {
                         $value = false;
                     } else {
                         $value = true;
                     }
                     TPL::cond('MODULE_CONFIG:' . strtoupper($item->name), $value);
                     break;
                 default:
                     $value = $item->value;
                     break;
             }
             TPL::add('MODULE_CONFIG:' . strtoupper($item->name), $value);
         }
     }
     $dir = dir('./langs/');
     while ($file = $dir->read()) {
         if ($file == '.' || $file == '..') {
             continue;
         }
         $langs[] = $file;
     }
     sort($langs);
     $f_langs = array();
     foreach ($langs as $lang) {
         $f_langs[] = array('LANG_CODENAME' => $lang, 'conds' => array('LANG_ACTIVE' => $lang == $cfg['etc']['core']['site_lang'] ? true : false));
     }
     TPL::assignAsLoop('MODULE_CONFIG:SITE_LANG', $f_langs);
     $f_langs = array();
     foreach ($langs as $lang) {
         $f_langs[] = array('LANG_CODENAME' => $lang, 'conds' => array('LANG_ACTIVE' => $lang == $cfg['etc']['core']['acp_lang'] ? true : false));
     }
     TPL::assignAsLoop('MODULE_CONFIG:ACP_LANG', $f_langs);
     $dir = dir('./styles/');
     while ($file = $dir->read()) {
         if ($file == '.' || $file == '..' || $file == '.acp') {
             continue;
         }
         $styles[] = $file;
     }
     sort($styles);
     $f_styles = array();
     foreach ($styles as $style) {
         $info = array();
         $path = './styles/' . $style . '/style.cfg';
         if (file_exists($path)) {
             $data = simplexml_load_file($path);
             foreach ($data->children() as $item) {
                 switch ($item['name']) {
                     case 'name':
                         $info['name'] = $item['value'];
                         break;
                     case 'author':
                         $info['author'] = $item['value'];
                         break;
                     case 'author_link':
                         $info['author_link'] = $item['value'];
                         break;
                     case 'preview':
                         $preview = true;
                         $info['preview'] = './styles/' . $style . '/' . $item['value'];
                         break;
                 }
             }
         }
         if (!isset($info['name'])) {
             $info['name'] = $style;
         }
         if (!isset($info['author'])) {
             $info['author'] = '{L_UNKNOWN}';
         }
         if (!isset($info['preview'])) {
             $preview = false;
             $info['preview'] = './styles/.acp/media/images/style_preview.png';
         }
         if ($style == $cfg['etc']['core']['site_style']) {
             TPL::add('MODULE_CONFIG:SITE_STYLE_NAME', strlen($info['name']) > 24 ? mb_substr($info['name'], 0, 24, 'UTF-8') . '...' : $info['name']);
         }
         $f_styles[] = array('STYLE_CODENAME' => $style, 'STYLE_NAME' => $info['name'], 'STYLE_AUTHOR' => $info['author'], 'STYLE_AUTHOR_LINK' => $info['author_link'], 'STYLE_PREVIEW' => $info['preview'], 'conds' => array('STYLE_ACTIVE' => $style == $cfg['etc']['core']['site_style'] ? true : false, 'STYLE_AUTHOR_LINK' => isset($info['author_link']) ? true : false, 'STYLE_PREVIEW' => $preview));
     }
//.........这里部分代码省略.........
开发者ID:jankuca,项目名称:smog-cms,代码行数:101,代码来源:core.mod.php

示例4: define

<?php

//if($_SERVER['REMOTE_ADDR'] != '86.49.84.27') die('Smog CMS is under construction!');
define('IN_SYS', true);
//define('TEMPLATE_DIRPATH','./styles/default/');
require './config.php';
TPL::assignAsLoop('MENU', array(array('MENU_LINK' => './', 'MENU_TEXT' => 'Homepage', 'MENU_ID' => '1', 'conds' => array('ACTIVE' => true, 'LAST' => false, 'SUBMENU' => false)), array('MENU_LINK' => './documentation', 'MENU_TEXT' => 'Documentation', 'MENU_ID' => '2', 'conds' => array('ACTIVE' => false, 'LAST' => false, 'SUBMENU' => true)), array('MENU_LINK' => './screenshots', 'MENU_TEXT' => 'Screenshots', 'conds' => array('ACTIVE' => false, 'LAST' => false, 'SUBMENU' => false)), array('MENU_LINK' => './faq', 'MENU_TEXT' => 'FAQ', 'conds' => array('ACTIVE' => false, 'LAST' => false, 'SUBMENU' => false)), array('MENU_LINK' => './download', 'MENU_TEXT' => 'Download', 'conds' => array('ACTIVE' => false, 'LAST' => false, 'SUBMENU' => false)), array('MENU_LINK' => './forum', 'MENU_TEXT' => 'Forum', 'conds' => array('ACTIVE' => false, 'LAST' => true, 'SUBMENU' => false))));
TPL::assignAsLoop('MENU.SUBMENU.2', array(array('MENU_SUBMENU_LINK' => './craap.php', 'MENU_SUBMENU_TEXT' => 'Craap!', 'conds' => array('ACTIVE' => true, 'LAST' => true))));
TPL::pack();
echo round(microtime(true) - $syslog->start, 3) * 1000 . ' ms';
/*echo('<br style="clear:both" />Output generated in <strong>' . round((microtime(true) - $start) * 1000) . ' ms</strong>.');
echo('<br /><br />');*/
//$syslog->log();
/*$sql = new SQLObject();
$sql->exec("UPDATE lsg_config SET value = 'Smog CMS' WHERE (name = 'SITE_HEADER')");
echo($sql->error);
//$sql->exec("INSERT INTO lsg_config (name,value,assign,type,module) VALUES ('SITE_HEADER','LSG-CMS',1,'string','core')");*/
开发者ID:jankuca,项目名称:smog-cms,代码行数:17,代码来源:index.php


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