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


PHP tag::getMiddleBody方法代码示例

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


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

示例1: getValue

 function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0)
 {
     //<stl:***></stl:***>
     $channelObj = bpBase::loadAppClass('channelObj', 'channel', 1);
     //
     $siteID = $avs['site'] == null ? $siteID : $avs['site'];
     //
     $upLevel = $avs['upLevel'] == null ? 0 : intval($avs['upLevel']);
     if ($avs['channelIndex']) {
         $thisChannel = $channelObj->getChannelByIndex($avs['channelIndex'], $siteID);
         $channels = $channelObj->getChannelsByParentID($thisChannel->id);
     } else {
         switch ($upLevel) {
             case 0:
                 break;
             case 1:
                 $currentChannel = $channelObj->getChannelByIndex($avs['channelIndex'], $siteID);
                 $channels = $channelObj->getChannelsByParentID($currentChannel->parentid);
                 break;
         }
     }
     //
     $returnStr = '';
     if ($channels) {
         $middleStr = parent::getMiddleBody($str, 'channels', $this->gTag);
         $i = 0;
         foreach ($channels as $c) {
             $start = intval($avs['startNum']) - 1;
             $count = intval($avs['totalNum']);
             if (!$count) {
                 $count = count($channels);
             }
             if ($i == $start || $i > $start) {
                 if ($i < $count) {
                     $rs = str_replace(array('[stl.channel.id]', '[stl.channel.name]', '[stl.channel.link]', '[stl.channel.num]', '<stl:contents'), array($c->id, $c->name, $c->link, $i + intval($avs['numStart']), '<stl:contents channelIndex="' . $c->cindex . '"'), $middleStr);
                     //current class
                     if ($channelID == $c->id) {
                         $rs = str_replace('[stl.channel.currentItemClass]', $avs['currentItemClass'], $rs);
                     } else {
                         $rs = str_replace('[stl.channel.currentItemClass]', '', $rs);
                     }
                     $returnStr .= $rs;
                 }
             }
             $i++;
         }
     }
     //处理stl:contents
     if (strExists($returnStr, '<stl:contents')) {
         $template = bpBase::loadAppClass('template', 'template');
         $now = SYS_TIME;
         $returnStr = $template->parseStr($returnStr, $now);
         @unlink(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $now . '.parsed.tpl.php');
         @unlink(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $now . '.tags.tpl.php');
     }
     //
     return $returnStr;
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:58,代码来源:tag_channels.class.php

示例2: getValue

 function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0)
 {
     //<stl:***></stl:***>
     $str = parent::removeProperties($str, $this->attributes);
     $middleStr = parent::getMiddleBody($str, 'a', $this->gTag);
     if (isset($avs['contentID']) && $avs['contentID']) {
         $articleObj = bpBase::loadAppClass('articleObj', 'article', 1);
         $thisContent = $articleObj->getContentByID($avs['contentID']);
         $valueStr = str_replace('[stl.content.title]', $thisContent->title, $middleStr);
         $link = $thisContent->link;
     } elseif (isset($avs['channelIndex']) && $avs['channelIndex']) {
         $channelObj = bpBase::loadAppClass('channelObj', 'channel', 1);
         if ($avs['site']) {
             //指定了站点
             $siteID = intval($avs['site']);
         }
         $thisChannel = $channelObj->getChannelByIndex($avs['channelIndex'], $siteID);
         //
         $valueStr = str_replace('[stl.channel.name]', $thisChannel->name, $middleStr);
         if ($avs['site'] || $siteID > 0) {
             //指定了站点
             $siteObj = bpBase::loadAppClass('siteObj', 'site', 1);
             $thisSite = $siteObj->getSiteByID($avs['site']);
             if (strExists($link, 'http://') || $thisChannel->externallink) {
                 $link = $thisChannel->link;
             } else {
                 $link = $thisSite->url . $thisChannel->link;
             }
         } else {
             if (strExists($link, 'http://') || $thisChannel->externallink) {
                 $link = $thisChannel->link;
             } else {
                 $link = MAIN_URL_ROOT . $thisChannel->link;
             }
         }
     } elseif (isset($avs['siteID']) && $avs['siteID']) {
         $siteObj = bpBase::loadAppClass('siteObj', 'site', 1);
         $thisSite = $siteObj->getSiteByID($avs['siteID']);
         //
         $valueStr = str_replace('[stl.site.name]', $thisSite->name, $middleStr);
         $link = $thisSite->url;
     }
     $str = str_replace('<stl:a', '<a href="' . $link . '"', $str);
     $str = str_replace('</stl:a', '</a', $str);
     $str = str_replace($middleStr, $valueStr, $str);
     return $str;
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:47,代码来源:tag_a.class.php

示例3: getValue

 function getValue($str = '', $avs, $csiteID = 0, $thisChannelID = 0, $contentID = 0)
 {
     //<stl:***></stl:***>
     $articleObj = bpBase::loadAppClass('articleObj', 'article');
     $site = bpBase::loadAppClass('siteObj', 'site');
     $content_db = bpBase::loadModel('article_model');
     $totalNum = $avs['totalNum'] ? $avs['totalNum'] : 10;
     $cat = $avs['cat'] ? $avs['cat'] : 'news';
     $cats = array('video', 'news', 'guide', 'comment', 'market');
     if (!in_array($cat, $cats)) {
         $cat = 'news';
     }
     $startNum = $avs['startNum'] ? intval($avs['startNum']) : 1;
     $startI = $startNum - 1;
     $totalNum = $startI + $totalNum;
     $orderBy = $avs['orderBy'] ? $avs['orderBy'] : 'viewcount';
     $contents = $articleObj->viewRanksByCat($cat, $totalNum, $orderBy);
     $returnStr = '';
     if ($contents) {
         $i = 0;
         $middleStr = parent::getMiddleBody($str, 'articleRanks', $this->gTag);
         $tags = array('[stl.content.link]', '[stl.content.title]', '[stl.content.thumb]');
         $count = 0;
         foreach ($contents as $c) {
             if ($i > $startI - 1 && $count < $totalNum) {
                 $replaces = array($c->link, $c->title, $c->thumb);
                 $valueStr = str_replace($tags, $replaces, $middleStr);
                 //time
                 $valueStr = str_replace('[stl.content.time]', date($avs['dateFormat'], $c->time), $valueStr);
                 //other thumb
                 $valueStr = str_replace('[stl.content.thumb2]', str_replace('.jpg', '_small.jpg', $c->thumb), $valueStr);
                 $valueStr = str_replace('[stl.content.thumb3]', str_replace('.jpg', '_middle.jpg', $c->thumb), $valueStr);
                 $valueStr = str_replace('[stl.content.thumb4]', str_replace('.jpg', '_big.jpg', $c->thumb), $valueStr);
                 //num
                 $valueStr = str_replace('[stl.content.num]', $count + $startNum, $valueStr);
                 //
                 $returnStr .= $valueStr;
                 $count++;
             }
             $i++;
         }
     }
     return $returnStr;
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:44,代码来源:tag_articleRanks.class.php

示例4: getValue

 function getValue($str = '', $avs, $csiteID = 0, $thisChannelID = 0, $contentID = 0)
 {
     //<stl:***></stl:***>
     $content = bpBase::loadAppClass('articleObj', 'article', 1);
     $mobileConfig = loadConfig('mobile');
     $articleObj = bpBase::loadAppClass('articleObj', 'article');
     $avs['numStart'] = isset($avs['numStart']) ? $avs['numStart'] : 1;
     if (!$avs['sqlStr']) {
         $isDynamic = $avs['isDynamic'] == null ? false : $avs['isDynamic'];
         $site = bpBase::loadAppClass('siteObj', 'site', 1);
         if ($avs['site']) {
             $thisSite = $site->getSiteByID($avs['site']);
             $siteID = intval($avs['site']);
         } else {
             $siteID = intval($csiteID);
         }
         if ($isDynamic || !isset($avs['sql']) || !strlen($avs['sql']) || $thisChannelID != 0 || $contentID != 0) {
             $channel = bpBase::loadAppClass('channelObj', 'channel', 1);
             //properties
             $num = intval($avs['totalNum']);
             $start = $avs['startNum'] == null ? 0 : intval($avs['startNum']) - 1;
             $scope = $avs['scope'] == null ? 'self' : 'children';
             $order = $avs['order'];
             if ($avs['isImage'] == null) {
                 $isImage = 'null';
             } else {
                 $isImage = $avs['isImage'] == 'true' ? 1 : 0;
             }
             switch ($order) {
                 case null:
                     $order = 'taxis';
                     break;
                 case 'Hits':
                     $order = 'viewcount';
                     break;
                 case 'AddDate':
                     $order = 'time';
                     break;
             }
             if ($avs['channelIndex']) {
                 $thisChannel = $channel->getChannelByIndex($avs['channelIndex'], $siteID);
                 $channelID = $thisChannel->id;
             } elseif ($avs['channelID']) {
                 $channelID = $avs['channelID'];
             } else {
                 $channelID = $thisChannelID;
             }
         }
         //
         $returnStr = '';
         if (!$isDynamic) {
             if (isset($avs['sql']) && strlen($avs['sql']) && !$thisChannelID) {
                 $content_db = bpBase::loadModel('article_model');
                 $avs['sql'] = str_replace('{sysTime}', SYS_TIME, $avs['sql']);
                 $contents = $content_db->get_resultsBySql($avs['sql']);
             } else {
                 $sql = $this->getSql($avs, $siteID, $thisChannelID);
                 //$content=bpBase::loadAppClass('articleObj','article',1);
                 $content_db = bpBase::loadModel('article_model');
                 $avs['sql'] = str_replace('{sysTime}', SYS_TIME, $avs['sql']);
                 $contents = $content_db->get_resultsBySql($avs['sql']);
                 //$contents=$content->getContentsByChannelID($channelID,$num,$order,$start,$scope,$isImage);
             }
             if ($contents) {
                 $i = 0;
                 $middleStr = parent::getMiddleBody($str, 'contents', $this->gTag);
                 $tags = array('[stl.fullTitle]', '[stl.content.fullTitle]', '[stl.content.author]', '[stl.content.source]', '[stl.content.thumb]', '[stl.content.content]', '[stl.content.autoname]');
                 foreach ($contents as $c) {
                     $replaces = array($c->title, $c->title, $c->author, $c->source, $c->thumb, $c->content, $c->autoname);
                     $valueStr = str_replace($tags, $replaces, $middleStr);
                     if ($avs['titleLen']) {
                         $valueStr = str_replace('[stl.content.title]', mb_substr($c->title, 0, $avs['titleLen'], DB_CHARSET), $valueStr);
                         if (strlen($c->subtitle)) {
                             //判断是否有副标题
                             $valueStr = str_replace('[stl.content.subtitle]', mb_substr($c->subtitle, 0, $avs['titleLen'], DB_CHARSET), $valueStr);
                         } else {
                             $valueStr = str_replace('[stl.content.subtitle]', mb_substr($c->title, 0, $avs['titleLen'], DB_CHARSET), $valueStr);
                         }
                     } else {
                         if (strlen($c->subtitle)) {
                             //判断是否有副标题
                             $valueStr = str_replace(array('[stl.content.title]', '[stl.content.subtitle]'), array($c->title, $c->subtitle), $valueStr);
                         } else {
                             $valueStr = str_replace(array('[stl.content.title]', '[stl.content.subtitle]'), array($c->title, $c->title), $valueStr);
                         }
                     }
                     if ($avs['introLen']) {
                         $valueStr = str_replace('[stl.content.intro]', mb_substr($c->intro, 0, $avs['introLen'], DB_CHARSET), $valueStr);
                     } else {
                         $valueStr = str_replace('[stl.content.intro]', $c->intro, $valueStr);
                     }
                     if ($avs['absPath'] || intval($avs['site']) != $csiteID) {
                         if (!$c->externallink) {
                             if ($i == 0) {
                                 $thisSite = $site->getSiteByID($c->site);
                             }
                             if (!$thisSite->url) {
                                 $thisSite->url = MAIN_URL_ROOT;
                             }
                             $valueStr = str_replace('[stl.content.link]', $thisSite->url . $c->link, $valueStr);
//.........这里部分代码省略.........
开发者ID:liuguogen,项目名称:weixin,代码行数:101,代码来源:tag_contents.class.php

示例5: getValue

 function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0)
 {
     //<stl:***></stl:***>
     $articleObj = bpBase::loadAppClass('articleObj', 'article');
     $mobileConfig = loadConfig('mobile');
     $content_db = bpBase::loadModel('article_model');
     $avs['sql'] = str_replace('{sysTime}', SYS_TIME, $avs['sql']);
     $contents = $content_db->get_resultsBySql($avs['sql']);
     $returnStr = '';
     if ($contents) {
         $middleStr = parent::getMiddleBody($str, 'groupContents', $this->gTag);
         $tags = array('[stl.content.author]', '[stl.content.source]', '[stl.content.thumb]', '[stl.content.content]');
         foreach ($contents as $c) {
             $title = $c->title ? $c->title : $c->atitle;
             $replaces = array($c->author, $c->source, $c->thumb, $c->content);
             $valueStr = str_replace($tags, $replaces, $middleStr);
             if ($avs['titleLen']) {
                 $valueStr = str_replace('[stl.content.title]', mb_substr($title, 0, $avs['titleLen'], DB_CHARSET), $valueStr);
                 if (strlen($c->subtitle)) {
                     //判断是否有副标题
                     $valueStr = str_replace('[stl.content.subtitle]', mb_substr($title, 0, $avs['titleLen'], DB_CHARSET), $valueStr);
                 } else {
                     $valueStr = str_replace('[stl.content.subtitle]', mb_substr($title, 0, $avs['titleLen'], DB_CHARSET), $valueStr);
                 }
             } else {
                 if (strlen($c->subtitle)) {
                     //判断是否有副标题
                     $valueStr = str_replace(array('[stl.content.title]', '[stl.content.subtitle]'), array($title, $title), $valueStr);
                 } else {
                     $valueStr = str_replace(array('[stl.content.title]', '[stl.content.subtitle]'), array($title, $title), $valueStr);
                 }
             }
             //other thumb
             $valueStr = str_replace('[stl.content.thumb2]', str_replace('.jpg', '_small.jpg', $c->thumb), $valueStr);
             $valueStr = str_replace('[stl.content.thumb3]', str_replace('.jpg', '_middle.jpg', $c->thumb), $valueStr);
             $valueStr = str_replace('[stl.content.thumb4]', str_replace('.jpg', '_big.jpg', $c->thumb), $valueStr);
             //
             if ($avs['introLen']) {
                 $valueStr = str_replace('[stl.content.intro]', mb_substr($c->intro, 0, $avs['introLen'], DB_CHARSET), $valueStr);
             } else {
                 $valueStr = str_replace('[stl.content.intro]', $c->intro, $valueStr);
             }
             $valueStr = str_replace('[stl.content.link]', $c->link, $valueStr);
             $valueStr = str_replace('[stl.content.fullTitle]', $c->atitle, $valueStr);
             $valueStr = str_replace('[stl.content.oTitle]', $c->atitle, $valueStr);
             $valueStr = str_replace('[stl.content.oSubTitle]', $c->asubtitle, $valueStr);
             $valueStr = str_replace('[stl.fullTitle]', $c->atitle, $valueStr);
             //手机版链接
             if ($c->externallink) {
                 $articleInfo = $articleObj->getLinkInfo($c->link);
                 if ($articleInfo) {
                     switch ($articleInfo['type']) {
                         case 'content':
                             $mlink = $mobileConfig['homeUrl'] . '/article/' . $articleInfo['id'];
                             break;
                         case 'storeContent':
                             $mlink = $mobileConfig['homeUrl'] . '/store/' . $articleInfo['storeid'] . '/article/' . $articleInfo['id'];
                             break;
                     }
                 } else {
                     $mlink = $c->link;
                 }
             } else {
                 $mlink = $mobileConfig['homeUrl'] . '/article/' . $c->id;
             }
             $valueStr = str_replace('[stl.content.mlink]', $mlink, $valueStr);
             //time
             $valueStr = str_replace('[stl.content.time]', date($avs['dateFormat'], $c->time), $valueStr);
             //auto info
             $autoids = explode(',', $c->autoid);
             $firstAutoid = 0;
             if ($autoids) {
                 foreach ($autoids as $autoid) {
                     if (intval($autoid)) {
                         $firstAutoid = $autoid;
                         break;
                     }
                 }
             }
             $valueStr = str_replace('[stl.content.autoID]', $firstAutoid, $valueStr);
             if (intval($c->autograde) == 1) {
                 if (URL_REWRITE) {
                     $valueStr = str_replace('[stl.content.autolink]', CAR_URL_ROOT . '/brand-' . $firstAutoid . '.html', $valueStr);
                 } else {
                     $valueStr = str_replace('[stl.content.autolink]', CAR_URL_ROOT . '/brand.php?id=' . $firstAutoid, $valueStr);
                 }
             } else {
                 if (URL_REWRITE) {
                     $valueStr = str_replace('[stl.content.autolink]', CAR_URL_ROOT . '/' . $firstAutoid, $valueStr);
                 } else {
                     $valueStr = str_replace('[stl.content.autolink]', CAR_URL_ROOT . '/g3auto.php?id=' . $firstAutoid, $valueStr);
                 }
             }
             if ($firstAutoid) {
                 $valueStr = str_replace('[stl.content.autodisplay]', '', $valueStr);
             } else {
                 $valueStr = str_replace('[stl.content.autodisplay]', ' style="display:none"', $valueStr);
             }
             //THIS AUTO
             if ($firstAutoid) {
//.........这里部分代码省略.........
开发者ID:ailingsen,项目名称:pigcms,代码行数:101,代码来源:tag_groupContents.class.php

示例6: getValue

 function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0, $pagination = array('pageSize' => 20, 'totalCount' => 0, 'currentPage' => 1, 'urlPrefix' => '', 'urlSuffix' => ''))
 {
     //<stl:***></stl:***>
     $middleStr = parent::getMiddleBody($str, 'pageItems', $this->gTag);
     //
     if (!$avs['type']) {
         $type = 'channel';
     } else {
         $type = $avs['type'];
     }
     $pageSize = intval($pagination['pageSize']);
     $currentPage = intval($pagination['currentPage']);
     $totalCount = intval($pagination['totalCount']);
     $totalPage = $totalCount % $pageSize > 0 ? intval($totalCount / $pageSize) + 1 : $totalCount / $pageSize;
     $returnStr = '';
     if ($totalPage > 1) {
         $returnStr = $middleStr;
         $nextPage = $currentPage + 1;
         $previousPage = $currentPage - 1;
         if ($currentPage == 1) {
             $firstPageLink = '';
             $previousPageLink = '';
             $nextPageLink = '<a href="' . $pagination['urlPrefix'] . '-' . $nextPage . $pagination['urlSuffix'] . '">' . $avs['nextPageText'] . '</a>';
             $lastPageLink = '<a href="' . $pagination['urlPrefix'] . '-' . $totalPage . $pagination['urlSuffix'] . '">' . $avs['lastPageText'] . '</a>';
         } elseif ($currentPage == $totalPage) {
             $firstPageLink = '<a href="' . $pagination['urlPrefix'] . $pagination['urlSuffix'] . '">' . $avs['firstPageText'] . '</a>';
             $previousPageLink = '<a href="' . $pagination['urlPrefix'] . '-' . $previousPage . $pagination['urlSuffix'] . '">' . $avs['previousPageText'] . '</a>';
             $nextPageLink = '';
             $lastPageLink = '';
         } else {
             $firstPageLink = '<a href="' . $pagination['urlPrefix'] . $pagination['urlSuffix'] . '">' . $avs['firstPageText'] . '</a>';
             $previousPageLink = '<a href="' . $pagination['urlPrefix'] . '-' . $previousPage . $pagination['urlSuffix'] . '">' . $avs['previousPageText'] . '</a>';
             $nextPageLink = '<a href="' . $pagination['urlPrefix'] . '-' . $nextPage . $pagination['urlSuffix'] . '">' . $avs['nextPageText'] . '</a>';
             $lastPageLink = '<a href="' . $pagination['urlPrefix'] . '-' . $totalPage . $pagination['urlSuffix'] . '">' . $avs['lastPageText'] . '</a>';
         }
         if ($currentPage == 2) {
             $previousPageLink = '<a href="' . $pagination['urlPrefix'] . $pagination['urlSuffix'] . '">' . $avs['previousPageText'] . '</a>';
         }
         //
         $pageSelect = '<script language="JavaScript">function PageSelect_1_jumpMenu(targ,selObj,restore){eval(targ+".location=\'"+selObj.options[selObj.selectedIndex].value+"\'");if (restore) selObj.selectedIndex=0;}</script><select name="PageSelect_1" id="PageSelect_1" onchange="PageSelect_1_jumpMenu(\'self\',this,0)">';
         $pageNavigation = '';
         for ($i = 1; $i < $totalPage + 1; $i++) {
             //
             if ($i == $currentPage) {
                 $linkClass = $avs['inactiveLinkClass'];
             } else {
                 $linkClass = $avs['activeLinkClass'];
             }
             if ($currentPage != $i) {
                 $selected = '';
             } else {
                 $selected = ' selected';
             }
             if ($i != 1) {
                 $pageNavigation .= '<a href="' . $pagination['urlPrefix'] . '-' . $i . $pagination['urlSuffix'] . '" class="' . $linkClass . '">' . $i . '</a>';
                 $pageSelect .= '<option value="' . $pagination['urlPrefix'] . '-' . $i . $pagination['urlSuffix'] . '"' . $selected . '>' . $i . '</option>';
             } else {
                 $pageNavigation .= '<a href="' . $pagination['urlPrefix'] . $pagination['urlSuffix'] . '" class="' . $linkClass . '">' . $i . '</a>';
                 $pageSelect .= '<option value="' . $pagination['urlPrefix'] . $pagination['urlSuffix'] . '"' . $selected . '>' . $i . '</option>';
             }
             //
         }
         $pageSelect .= '</select>';
         //
         if ($currentPage != $totalPage) {
             $nextI = $currentPage + 1;
             $pageNavigation .= '<a href="' . $pagination['urlPrefix'] . '-' . $nextI . $pagination['urlSuffix'] . '" class="' . $linkClass . '">下一页</a>';
         }
         if ($currentPage != 1) {
             if ($currentPage != 2) {
                 $previousI = $currentPage - 1;
                 $pageNavigation = '<a href="' . $pagination['urlPrefix'] . '-' . $previousI . $pagination['urlSuffix'] . '" class="' . $avs['activeLinkClass'] . '">上一页</a>' . $pageNavigation;
             } else {
                 $pageNavigation = '<a href="' . $pagination['urlPrefix'] . $pagination['urlSuffix'] . '" class="' . $avs['activeLinkClass'] . '">上一页</a>' . $pageNavigation;
             }
         }
         //
         $returnStr = str_replace(array('[stl.pagination.firstPage]', '[stl.pagination.previousPage]', '[stl.pagination.nextPage]', '[stl.pagination.lastPage]', '[stl.pagination.currentPage]', '[stl.pagination.totalPage]', '[stl.pagination.pageSelect]', '[stl.pagination.pageNavigation]'), array($firstPageLink, $previousPageLink, $nextPageLink, $lastPageLink, $currentPage, $totalPage, $pageSelect, $pageNavigation), $middleStr);
     }
     return $returnStr;
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:81,代码来源:tag_pageItems.class.php

示例7: getValue

 function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0, $pagination = array())
 {
     //<stl:***></stl:***>
     $scope = $avs['scope'] == null ? 'self' : 'children';
     if ($avs['isImage'] == null) {
         $avs['isImage'] = 'null';
     } else {
         $avs['isImage'] = $avs['isImage'] == 'true' ? 1 : 0;
     }
     switch ($avs['order']) {
         default:
             $order = 'taxis';
             break;
         case null:
             $order = 'taxis';
             break;
         case 'Hits':
             $order = 'viewcount';
             break;
         case 'AddDate':
             $order = 'time';
             break;
     }
     $num = $avs['pageNum'];
     if (!intval($num)) {
         $num = 20;
     }
     //
     $content = bpBase::loadAppClass('articleObj', 'article', 1);
     $sepratorCount = intval($avs['seperatorCount']);
     $totalCount = $pagination['totalCount'];
     $pageSize = intval($num);
     $currentPage = $pagination['currentPage'];
     $start = ($currentPage - 1) * $pageSize;
     $contents = $content->getContentsByChannelID($channelID, $pageSize, $order, $start, $scope, $isImage);
     $returnStr = '';
     if ($contents) {
         $middleStr = parent::getMiddleBody($str, 'pageContents', $this->gTag);
         $tags = array('[stl.fullTitle]', '[stl.content.author]', '[stl.content.source]', '[stl.content.thumb]', '[stl.content.content]');
         $i = 0;
         foreach ($contents as $c) {
             $replaces = array($c->title, $c->author, $c->source, $c->thumb, $c->content);
             $valueStr = str_replace($tags, $replaces, $middleStr);
             if ($avs['titleLen']) {
                 $valueStr = str_replace('[stl.content.title]', mb_substr($c->title, 0, $avs['titleLen'], DB_CHARSET), $valueStr);
                 $valueStr = str_replace('[stl.content.subtitle]', mb_substr($c->subtitle, 0, $avs['titleLen'], DB_CHARSET), $valueStr);
             } else {
                 $valueStr = str_replace(array('[stl.content.title]', '[stl.content.subtitle]'), array($c->title, $c->subtitle), $valueStr);
             }
             if ($avs['introLen']) {
                 $valueStr = str_replace('[stl.content.intro]', mb_substr($c->intro, 0, $avs['introLen'], DB_CHARSET), $valueStr);
             } else {
                 $valueStr = str_replace('[stl.content.intro]', $c->intro, $valueStr);
             }
             if ($avs['absPath']) {
                 $site = bpBase::loadAppClass('siteObj', 'site', 1);
                 $thisSite = $site->getSiteByID($siteID);
                 $valueStr = str_replace('[stl.content.link]', $thisSite->url . $c->link, $valueStr);
             } else {
                 $valueStr = str_replace('[stl.content.link]', $c->link, $valueStr);
             }
             //time
             $valueStr = str_replace('[stl.content.time]', date($avs['dateFormat'], $c->time), $valueStr);
             $returnStr .= $valueStr;
             //seperator
             $i++;
             if ($sepratorCount && $i % $sepratorCount == 0 && $i != $pageSize) {
                 $returnStr .= '<div class="pageContentsSeperator"></div>';
             }
         }
     }
     return $returnStr;
 }
开发者ID:ailingsen,项目名称:pigcms,代码行数:73,代码来源:tag_pageContents.class.php


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