好!欢迎访问迷津渡口 现在时间是: 天气 °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
   支持一下
挤眼 亲亲 咆哮 开心 想想 可怜 糗大了 委屈 哈哈 小声点 右哼哼 左哼哼 疑问 坏笑 赚钱啦 悲伤 耍酷 勾引 厉害 握手 耶 嘻嘻 害羞 鼓掌 馋嘴 抓狂 抱抱 围观 威武 给力
 点赞
 签到
 表情
 图片
 代码
提交评论

清空信息
关闭评论
prada black bag
 prada black bag 2019-04-24 22:10回复
#188
<a href="http://www.mojitocafevab.com/nfl-mens-chicago-bears-nike-navy-sideline-thermafit-performance-po-hoodie-nflt">nfl mens chicago bears nike navy sideline thermafit performance po hoodie</a> <a href="http://www.inxpressca.com/air-max-90-oreo-quick-trainersd">air max 90 oreo quick</a> <a href="http://www.edannaturals.com/billig-nike-kobe-9-mid-dam%C3%A4nner-rot-runninga">billig nike kobe 9 mid dam盲nner rot</a> <a href="http://www.bestpricetvz.com/air-jordan-14-s%C3%B8lv-gr%C3%B8nn-kurpesb">air jordan 14 s酶lv gr酶nn</a> <a href="http://www.playwithal.com/oakley-baseball-sunglasses-m-frame-sunglassesr">oakley baseball sunglasses m frame</a> <a href="http://www.mysebringpd.com/elite-keenan-allen-youth-jersey-san-diego-chargers-13-road-white-nfld">elite keenan allen youth jersey san diego chargers 13 road white</a>
prada black bag http://www.localeldernet.com/prada-black-bag-pradar
funviralpark
 funviralpark 2019-04-24 20:52回复
#187
<a href="http://www.completefight.com/nike-air-max-lunar-1-deluxe-noir-market-obuva">nike air max lunar 1 deluxe noir market</a> <a href="http://www.dealingsnet.com/air-jordan-retro-1-viola-gamma-blu-obuvf">air jordan retro 1 viola gamma blu</a> <a href="http://www.eyehearsea.com/supra-vaider-rosso-obuvf">supra vaider rosso</a> <a href="http://www.flixflight.com/nike-internationalist-jcrd-rosa-svart-schuhef">nike internationalist jcrd rosa svart</a> <a href="http://www.adappi.com/air-jordan-10-alle-hvid-sko-kurpesd">air jordan 10 alle hvid sko</a> <a href="http://www.berealto.com/nike-roshe-run-triangle-p%C3%BArpura-amarillo-butyf">nike roshe run triangle p煤rpura amarillo</a>
funviralpark http://www.funviralpark.com/
mintyschoice
 mintyschoice 2019-04-24 04:25回复
#186
<a href="http://www.atrapaniapp.com/femmes-nike-kyrie-2-blanc-jaune-chaussuresh">femmes nike kyrie 2 blanc jaune</a> <a href="http://www.maplebeyond.com/nike-kd-8-femminile-viola-rosso-scarpeq">nike kd 8 femminile viola rosso</a> <a href="http://www.collisionsix.com/mens-nike-air-max-87-sb-green-grey-shoesj">mens nike air max 87 sb green grey</a> <a href="http://www.todololitas.com/nike-kobe-vii-wolf-gr%C3%A5-skoi">nike kobe vii wolf gr氓</a> <a href="http://www.jcwjrlaw.com/nike-flyknit-lunar-3-femminile-oro-grigio-scarpel">nike flyknit lunar 3 femminile oro grigio</a> <a href="http://www.vstsblog.com/mens-asics-gel-noosa-tri-7-silver-blue-shoesj">mens asics gel noosa tri 7 silver blue</a>
mintyschoice http://www.mintyschoice.com/
rawbiofast
 rawbiofast 2019-04-23 19:50回复
#185
<a href="http://www.laketreepress.com/mujeres-nike-lebron-13-blanco-naranja-zapatosk">mujeres nike lebron 13 blanco naranja</a> <a href="http://www.prohaarklinik.com/nike-roshe-run-nm-negro-dark-magnet-gris-zapatosp">nike roshe run nm negro dark magnet gris</a> <a href="http://www.bonfanticare.com/pink-north-face-denali-northfaceh">pink north face denali</a> <a href="http://www.antoniopagni.com/nike-free-inneva-woven-grau-tan-schuhej">nike free inneva woven grau tan</a> <a href="http://www.wcshosting.com/kvinders-air-max-90-hyperfuse-lyser%C3%B8d-guld-skoh">kvinders air max 90 hyperfuse lyser酶d guld</a> <a href="http://www.biddingstream.com/nike-kd-7-rose-rouge-chaussuresh">nike kd 7 rose rouge</a>
rawbiofast http://www.rawbiofast.com/
prepperdays
 prepperdays 2019-04-23 09:59回复
#184
<a href="http://www.showboxi.com/adidas-prossoator-instinct-astro-turf-scarpeh">adidas prossoator instinct astro turf</a> <a href="http://www.erzincanet.com/adidas-ultra-boost-all-black-uncaged-shoesk">adidas ultra boost all black uncaged</a> <a href="http://www.hoyerequip.com/ray-ban-wayfarer-black-on-black-sunglassesh">ray ban wayfarer black on black</a> <a href="http://www.oreandacasino.com/nike-air-max-2014-hommes-noir-blanc-chaussuresl">nike air max 2014 hommes noir blanc</a> <a href="http://www.floraroja.com/gris-blanc-hommes-adidas-springblade-drive-chaussures-chaussuresl">gris blanc hommes adidas springblade drive chaussures</a> <a href="http://www.dazedkayla.com/nike-air-max-1-wei%C3%9F-schuhej">nike air max 1 wei脽</a>
prepperdays http://www.prepperdays.com/
justprogaming
 justprogaming 2019-04-22 14:39回复
#183
<a href="http://www.rexpousa.com/nike-zoom-vomero-10-bianca-scarpei">nike zoom vomero 10 bianca</a> <a href="http://www.dalvadesign.com/adidas-porsche-design-bounce-s4-cuero-blanco-negro-zapatosh">adidas porsche design bounce s4 cuero blanco negro</a> <a href="http://www.velvetwifi.com/adidas-gazelle-og-gr%C3%A5-hvid-skok">adidas gazelle og gr氓 hvid</a> <a href="http://www.sophiarugby.com/svart-r%C3%B8d-gr%C3%A5-nike-huarache-obuvi">svart r酶d gr氓 nike huarache</a> <a href="http://www.thumbglovepro.com/nike-air-max-tavas-negro-rojo-zapatosl">nike air max tavas negro rojo</a> <a href="http://www.ceracustica.com/ray-ban-sunglasses-rb4165-justin-sunglassesh">ray ban sunglasses rb4165 justin</a>
justprogaming http://www.justprogaming.com/
arealleader
 arealleader 2019-04-22 12:08回复
#182
<a href="http://www.whatoiljobs.com/m%C3%A4nner-adidas-zx-flux-weave-blau-rot-schuhej">m盲nner adidas zx flux weave blau rot</a> <a href="http://www.mustberavi.com/schwarz-rosa-and-lila-nike-air-max-schuhei">schwarz rosa and lila nike air max</a> <a href="http://www.dynamixawards.com/blazer-nike-hvit-obuvj">blazer nike hvit</a> <a href="http://www.nerdalertnews.com/maschio-nike-kobe-9-nero-bianca-scarpel">maschio nike kobe 9 nero bianca</a> <a href="http://www.dmvantalya.com/nike-air-max-plus-tn-vert-chaussuresh">nike air max plus tn vert</a> <a href="http://www.houshyaree.com/adidas-rose-7-verde-blu-scarpeh">adidas rose 7 verde blu</a>
arealleader http://www.arealleader.com/
djpunjabii
 djpunjabii 2019-04-22 06:55回复
#181
<a href="http://www.soopsip.com/mens-nike-epic-react-flyknit-yellow-shoesj">mens nike epic react flyknit yellow</a> <a href="http://www.laodikyahaber.com/cleveland-cavaliers-new-era-nba-all-heather-59fifty-cap-hatk">cleveland cavaliers new era nba all heather 59fifty cap</a> <a href="http://www.dateplannerz.com/nike-classic-cortez-l%C3%A6der-hvid-skoj">nike classic cortez l忙der hvid</a> <a href="http://www.ultimumbaby.com/ralph-lauren-white-oxford-shirt-poloh">ralph lauren white oxford shirt</a> <a href="http://www.cksholdings.com/adidas-zx-flux-grey-blue-shoesi">adidas zx flux grey blue</a> <a href="http://www.rosebasil.com/jordan-eclipse-arancia-and-bianca-scarpej">jordan eclipse arancia and bianca</a>
djpunjabii http://www.djpunjabii.com/
dylanhassinger
 dylanhassinger 2019-04-22 06:39回复
#180
<a href="http://www.abcmaster.net/jordan-11-r%C3%B8d-sort-hvid-kurpese">jordan 11 r酶d sort hvid</a> <a href="http://www.abracadabranche.net/nike-air-presto-4d-gull-brun-scarpea">nike air presto 4d gull brun</a> <a href="http://www.accademiadeilincei.net/adidas-zx-700-marrone-gituttio-obuvb">adidas zx 700 marrone gituttio</a> <a href="http://www.addaxia.net/nike-huarache-dark-grau-cobalt-magenta-chaussuresc">nike huarache dark grau cobalt magenta</a> <a href="http://www.adultlivesexx.net/air-max-95-rojo-blanco-azul-zones-kurpesg">air max 95 rojo blanco azul zones</a> <a href="http://www.affluentadvisors.net/nike-zoom-pegasus-33-in-esecuzione-scarpe-nero-schuhea">nike zoom pegasus 33 in esecuzione scarpe nero</a>
dylanhassinger http://www.dylanhassinger.net/
myersmotors
 myersmotors 2019-04-21 17:55回复
#179
<a href="http://www.florianscafe.net/jordan-retro-7-schwarz-blau-scarpee">jordan retro 7 schwarz blau</a> <a href="http://www.floridalighthouse.net/nike-hyperdunk-2013-atomic-r%C3%B8d-dark-gr%C3%A5-wolf-gr%C3%A5-kurpesa">nike hyperdunk 2013 atomic r酶d dark gr氓 wolf gr氓</a> <a href="http://www.fortknoxjewelers.net/nike-free-run-4.0-svart-qb-kurpesc">nike free run 4.0 svart qb</a> <a href="http://www.freerivalcasinos.net/kvinders-air-jordan-retro-6-bl%C3%A5-guld-obuva">kvinders air jordan retro 6 bl氓 guld</a> <a href="http://www.friendsofugami.net/adidas-yeezy-boost-350-ni%C3%B1os-verde-blanco-schuhef">adidas yeezy boost 350 ni帽os verde blanco</a> <a href="http://www.fullertonchamber.net/nike-roshe-run-svart-l%C3%A6r-chaussuresg">nike roshe run svart l忙r</a>
myersmotors http://www.myersmotors.net/
顶部留言底部
 00:00/00:00
我想和你虚度时光 - 花房姑娘(9)
  1. 我想和你虚度时光
  2. 花房姑娘
  3. 恋恋风尘
  4. 我喜爱一切不彻底的事物
  5. 我的心里是满的
  6. Long Way
  7. 给少年的歌
  8. 晴日共剪窗
  9. 天上的月你的脸