好!欢迎访问迷津渡口 现在时间是: 天气 °C ~ °C

迷津渡口

越感到迷惑 越接近真理

emlog MVC解构22--控制器Controller之Tag_Controller

Tag_Controller控制器用于输出标签文章列表,仅有一个方法:display($params)。

function display($params) {
    // 建立日志模型
    $Log_Model = new Log_Model();
    // 建立配置缓存
    $options_cache = Option::getAll();
    // 配置缓存数组键名转换成变量,键值转换成对应的变量值
    extract($options_cache);
    
    // 获取页码,路径未包含则设置为1
    $page = isset($params[4]) && $params[4] == 'page' ? abs(intval($params[5])) : 1;
    // 获取标签名,路径未包含则设置为空
    $tag = isset($params[1]) && $params[1] == 'tag' ? addslashes(urldecode(trim($params[2]))) : '';
    
    // 定义访问路径
    $pageurl = '';
    
    // 设置标签页面站点标题为标签名-站点浏览器标题
    $site_title = stripslashes($tag) . ' - ' . $site_title;
    
    // 建立标签模型
    $Tag_Model = new Tag_Model();
    // 通过标签名称获取包含此标签的日志ID以逗号分隔的字符串
    $blogIdStr = $Tag_Model->getTagByName($tag);
    
    // 标签不包含在任意日志则输出404页面
    if ($blogIdStr === false) {
        show_404_page();
    }
    // 设置数据库搜索条件,从新到旧排列结果
    $sqlSegment = "and gid IN ($blogIdStr) order by date desc";
    // 获取包含标签的日志数量
    $lognum = $Log_Model->getLogNum('n', $sqlSegment);
    
    // 获取标签列表的总页数
    $total_pages = ceil($lognum / $index_lognum);
    if ($page > $total_pages) { // 页码超过总页数
        // 页码设为最后一页
        $page = $total_pages;
    }
    // 利用工具类Url获取标签页面链接
    $pageurl .= Url::tag(urlencode($tag), 'page');
    
    
    // 获取日志列表数组
    $logs = $Log_Model->getLogsForHome($sqlSegment, $page, $index_lognum);
    // 利用工具函数获取输出列表页底部页码导航的字符串
    $page_url = pagination($lognum, $index_lognum, $page, $pageurl);
    
    // View调用前台模板header.php和log_list.php输出标签列表页面
    include View::getView('header');
    include View::getView('log_list');
}


点赞0
   支持一下
挤眼 亲亲 咆哮 开心 想想 可怜 糗大了 委屈 哈哈 小声点 右哼哼 左哼哼 疑问 坏笑 赚钱啦 悲伤 耍酷 勾引 厉害 握手 耶 嘻嘻 害羞 鼓掌 馋嘴 抓狂 抱抱 围观 威武 给力
 点赞
 签到
 表情
 图片
 代码
提交评论

清空信息
关闭评论
joyhaughton
 joyhaughton 约 3 小时前回复
#278
<a href="http://www.popofred.com/kvinners-nike-roshe-run-high-bl%C3%A5-gr%C3%B8nn-kurpese">kvinners nike roshe run high bl氓 gr酶nn</a> <a href="http://www.murekachart.com/pandora-flower-birthstone-charm-numbers-pandoral">pandora flower birthstone charm numbers</a> <a href="http://www.naturecaredoc.com/louboutin-wedges-black-hair-louboutine">louboutin wedges black hair</a> <a href="http://www.protowbend.com/hermes-bag-2015-australia-hermesc">hermes bag 2015 australia</a> <a href="http://www.twominuteview.com/kobe-9-ni%C3%B1os-footg">kobe 9 ni帽os</a> <a href="http://www.stephenemay.com/parajumpers-coat-brands-hair-parajumpersa">parajumpers coat brands hair</a>
joyhaughton http://www.joyhaughton.com/
sanduicheria
 sanduicheria 约 4 小时前回复
#277
<a href="http://www.alminehealing.com/air-jordan-8-retro-ice-bleu-zone-chaussuresb">air jordan 8 retro ice bleu zone</a> <a href="http://www.eightitude.com/free-100-nike-gift-card-zapatosj">free 100 nike gift card</a> <a href="http://www.salsamonde.com/adidas-prossoator-rosa-gloves-obuvf">adidas prossoator rosa gloves</a> <a href="http://www.dermiskincare.com/pandora-earrings-canada-maple-pandoraj">pandora earrings canada maple</a> <a href="http://www.ricusiowo.com/nike-kvinders-internationalist-prm-l%C3%B8b-sko-trainersd">nike kvinders internationalist prm l酶b sko</a> <a href="http://www.okcintergroup.com/nike-foamposite-boots-negro-acg-hombres-chaussuresm">nike foamposite boots negro acg hombres</a>
[url=http://www.sanduicheria.com/]sanduicheria[/url]
barrylipscomb
 barrylipscomb 2019-12-14 06:29回复
#276
<a href="http://www.getfape.com/air-jordan-30.5-brun-gr%C3%B8n-trainersd">air jordan 30.5 brun gr酶n</a> <a href="http://www.aimauctions.com/air-jordan-retro-5-femmes-bleu-ciel-orange-chaussuresm">air jordan retro 5 femmes bleu ciel orange</a> <a href="http://www.wishsupporter.com/herre-ralph-lauren-stripe-polo-brun-bl%C3%A5-poloa">herre ralph lauren stripe polo brun bl氓</a> <a href="http://www.revisionsbacs.com/adidas-zx-flux-winter-gr%C3%A5-turquoise-scarpek">adidas zx flux winter gr氓 turquoise</a> <a href="http://www.duvetboutique.com/blumen-kleid-charlotte-russe-dresse">blumen kleid charlotte russe</a> <a href="http://www.bestmotosport.com/nike-air-max-lebron-low-footi">nike air max lebron low</a>
barrylipscomb http://www.barrylipscomb.com/
rostovobuv
 rostovobuv 2019-12-14 05:28回复
#275
<a href="http://www.fooddorks.com/pandora-bracelet-925-ale-xl-pandorad">pandora bracelet 925 ale xl</a> <a href="http://www.nicobeenker.com/nike-shox-deliver-bianca-nero-keys-trainersi">nike shox deliver bianca nero keys</a> <a href="http://www.metanorn.com/nike-roshe-run-slip-bl%C3%A5-lilla-chaussuresg">nike roshe run slip bl氓 lilla</a> <a href="http://www.thepdregistry.com/ralph-lauren-jumper-sweater-nz-poloa">ralph lauren jumper sweater nz</a> <a href="http://www.immocentrevar.com/herren-nike-air-max-90-rosa-blau-scarpee">herren nike air max 90 rosa blau</a> <a href="http://www.anvemedia.com/phase-eight-navy-floral-tapework-dress-dresse">phase eight navy floral tapework dress</a>
rostovobuv http://www.rostovobuv.com/
freakvr
 freakvr 2019-12-14 00:18回复
#274
<a href="http://www.docelarsjc.com/dames-parajumpers-bear-vest-parajumpersb">dames parajumpers bear vest</a> <a href="http://www.olneyagroup.com/oakley-mens-lifestyle-sunglasses-sunglassesr">oakley mens lifestyle sunglasses</a> <a href="http://www.sftfinance.com/the-north-face-jacket-au-northfacec">the north face jacket au</a> <a href="http://www.cheljm.com/nike-womens-roshe-run-speckles-gamma-grey-black-runningc">nike womens roshe run speckles gamma grey black</a> <a href="http://www.foolheartedly.com/nike-air-pegasus-83-metallic-skos">nike air pegasus 83 metallic</a> <a href="http://www.paulawooley.com/adidas-crazylight-boost-neon-gr%C3%BCn-knight-kurpesg">adidas crazylight boost neon gr眉n knight</a>
freakvr http://www.freakvr.com/
luminorama
 luminorama 2019-12-13 16:21回复
#273
<a href="http://www.cytechretail.com/christian-louboutin-leopard-print-ankle-boots-6pm-louboutine">christian louboutin leopard print ankle boots 6pm</a> <a href="http://www.proseccoexpo.com/hermes-evelyne-pm-3-down-hermesc">hermes evelyne pm 3 down</a> <a href="http://www.utkoinonia.com/roshe-run-rosa-cool-gr%C3%A5-footg">roshe run rosa cool gr氓</a> <a href="http://www.shamswesley.com/parajumpers-vest-clothing-names-parajumpersa">parajumpers vest clothing names</a> <a href="http://www.osirisdance.com/men-moncler-jacket-long-jeans-monclera">men moncler jacket long jeans</a> <a href="http://www.whereandwhyfi.com/air-jordan-3-true-azul-outfit-maker-chaussuresb">air jordan 3 true azul outfit maker</a>
luminorama http://www.luminorama.com/
tasdizayni
 tasdizayni 2019-12-13 04:17回复
#272
<a href="http://www.erickasouza.com/nike-air-max-2017-l%C3%A6r-gull-gr%C3%B8nn-kurpese">nike air max 2017 l忙r gull gr酶nn</a> <a href="http://www.extrasklepik.com/nike-womens-gareon-conley-limited-white-jersey-oakland-raiders-nfl-21-rush-vapor-untouchable-nflt">nike womens gareon conley limited white jersey oakland raiders nfl 21 rush vapor untouchable</a> <a href="http://www.psychedelicsf.com/mackage-wool-coat-mackager">mackage wool coat</a> <a href="http://www.sncforyou.com/ralph-lauren-city-polo-rojo-marr%C3%B3n-polow">ralph lauren city polo rojo marr贸n</a> <a href="http://www.allefuerbeate.com/lebron-witness-meaning-sportsc">lebron witness meaning</a> <a href="http://www.djdiscgolf.com/air-max-camo-prm-tape-trainerse">air max camo prm tape</a>
tasdizayni http://www.tasdizayni.com/
wysyflow
 wysyflow 2019-12-12 08:24回复
#271
<a href="http://www.zanetarecords.com/canada-goose-jacket-outlet-uk-used-canadagooseb">canada goose jacket outlet uk used</a> <a href="http://www.acesignsgroup.com/jordan-11-legend-bl%C3%A5-tag-kurpesk">jordan 11 legend bl氓 tag</a> <a href="http://www.barrylipscomb.com/pandora-charms-birthstone-february-update-pandoraf">pandora charms birthstone february update</a> <a href="http://www.adoseofdupas.com/christian-louboutin-rosella-flat-black-boots-louboutine">christian louboutin rosella flat black boots</a> <a href="http://www.dwnldmedia.com/hermes-belts-price-drop-hermesc">hermes belts price drop</a> <a href="http://www.imistudio.com/yeezy-boost-350-zebra-for-salg-online-footm">yeezy boost 350 zebra for salg online</a>
wysyflow http://www.wysyflow.com/
primumlive
 primumlive 2019-12-11 16:41回复
#270
<a href="http://www.tasdizayni.com/herre-jordan-10-powder-bl%C3%A5-butyb">herre jordan 10 powder bl氓</a> <a href="http://www.blogtourney.com/mackage-duffle-coat-mackager">mackage duffle coat</a> <a href="http://www.edgethrive.com/yeezy-750-boost-pirate-svart-keys-butyf">yeezy 750 boost pirate svart keys</a> <a href="http://www.kewauneecares.com/nike-kyrie-1-r%C3%B8d-and-svart-obuva">nike kyrie 1 r酶d and svart</a> <a href="http://www.resekipman.com/nike-air-max-bw-braun-deer-obuvc">nike air max bw braun deer</a> <a href="http://www.robineliza.com/ralph-lauren-pony-polo-violet-beige-polou">ralph lauren pony polo violet beige</a>
primumlive http://www.primumlive.com/
ksmartcity
 ksmartcity 2019-12-11 09:51回复
#269
<a href="http://www.lateraline.com/nike-free-run-5.0-neon-green-and-blue-trainersa">nike free run 5.0 neon green and blue</a> <a href="http://www.naijareward.com/14-elite-vincent-brown-indianapolis-colts-youth-jersey-home-royal-blue-nfld">14 elite vincent brown indianapolis colts youth jersey home royal blue</a> <a href="http://www.smsteachers.com/nike-air-max-87-sb-sliver-grau-gr%C3%BCn-chaussuresf">nike air max 87 sb sliver grau gr眉n</a> <a href="http://www.alfiekaye.com/air-jordan-after-game-i-yellow-green-trainerse">air jordan after game i yellow green</a> <a href="http://www.eatisrael.com/tory-burch-striped-bag-toryburchr">tory burch striped bag</a> <a href="http://www.introtecint.com/yeezy-boost-750-rosso-october-build-butye">yeezy boost 750 rosso october build</a>
ksmartcity http://www.ksmartcity.com/
顶部留言底部
 00:00/00:00
我想和你虚度时光 - 花房姑娘(9)
  1. 我想和你虚度时光
  2. 花房姑娘
  3. 恋恋风尘
  4. 我喜爱一切不彻底的事物
  5. 我的心里是满的
  6. Long Way
  7. 给少年的歌
  8. 晴日共剪窗
  9. 天上的月你的脸