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

迷津渡口

越感到迷惑 越接近真理

emlog MVC解构25--控制器Controller之Author_Controller

Author_Controller控制器用于查看作者文章列表页面,仅有一个方法:display($params)。

function display($params) {
    // 建立日志模型
    $Log_Model = new Log_Model();
    // 新建缓存
    $CACHE = Cache::getInstance();
    // 获取配置缓存
    $options_cache = Option::getAll();
    // 配置缓存输出键名转换成变量名,键值转换成变量值
    extract($options_cache);
    
    // 获取页码,未配置则设为首页1
    $page = isset($params[4]) && $params[4] == 'page' ? abs(intval($params[5])) : 1;
    // 获取作者ID,未配置则设为空
    $author = isset($params[1]) && $params[1] == 'author' ? intval($params[2]) : '' ;
    
    // 定义访问路径变量
    $pageurl = '';
    
    // 获取用户缓存
    $user_cache = $CACHE->readCache('user');
    // 用户缓存不存在此用户,则输出404页面
    if (!isset($user_cache[$author])) {
        show_404_page();
    }
    
    // 获取用户名
    $author_name = $user_cache[$author]['name'];
    // 用户文章列表页面站点标题设置为作者名-站点浏览器标题
    $site_title = $author_name . ' - ' . $site_title;
    
    // 设置数据库搜索条件为此用户日志,从新到旧排列
    $sqlSegment = "and author=$author order by date desc";
    // 获取统计缓存
    $sta_cache = $CACHE->readCache('sta');
    // 获取此用户已发布日志总数量
    $lognum = $sta_cache[$author]['lognum'];
    
    // 获取用户文章列表页面总页数
    $total_pages = ceil($lognum / $index_lognum);
    if ($page > $total_pages) { // 页码超过总页数
        // 页码设置为最后一页
        $page = $total_pages;
    }
    // 数据库搜索的开始限制
    $start_limit = ($page - 1) * $index_lognum;
    // 利用工具类Url获取作者文章列表页的链接
    $pageurl .= Url::author($author, 'page');
    
    // 建立日志模型
    $Log_Model = new Log_Model();
    // 获取日志列表
    $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');
}


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

清空信息
关闭评论
vorsch
 vorsch 约 19 小时前回复
#118
<a href="http://www.potenzolasli.com/nike-roshe-run-oransje-leopard-salg-kurpesa">nike roshe run oransje leopard salg</a> <a href="http://www.roeschtires.com/jordan-5-fire-rosso-how-much-butyg">jordan 5 fire rosso how much</a> <a href="http://www.royphelps.com/team-ca-9-matt-duchene-red-2016-world-cup-stitched-nhl-jersey-nflw">team ca 9 matt duchene red 2016 world cup stitched nhl jersey</a> <a href="http://www.sekaiblog.com/herren-asics-gel-noosa-tri-10-gelb-grau-butye">herren asics gel noosa tri 10 gelb grau</a> <a href="http://www.agneaublanc.com/nike-flynit-max-mujeres-p%C3%BArpura-kurpesc">nike flynit max mujeres p煤rpura</a> <a href="http://www.dawndesantis.com/hommes-ralph-lauren-tank-top-jaune-bleu-polow">hommes ralph lauren tank top jaune bleu</a>
vorsch http://www.vorsch.com/
clickstroy
 clickstroy 约 21 小时前回复
#117
<a href="http://www.keleric.com/nike-roshe-two-flyknit-violet-argent-chaussuresh">nike roshe two flyknit violet argent</a> <a href="http://www.jeffreya.com/prada-shoulder-jet-set-bt1221-handbags-in-black-pradah">prada shoulder jet set bt1221 handbags in black</a> <a href="http://www.vuduchoan.com/old-time-hockey-minnesota-wild-11-zach-parise-red-hoodie-nfli">old time hockey minnesota wild 11 zach parise red hoodie</a> <a href="http://www.gmfamilylaw.com/nike-air-max-1-hyperfuse-og-bl%C3%A5-skoq">nike air max 1 hyperfuse og bl氓</a> <a href="http://www.clubephytus.com/us-polo-v-neck-poloh">us polo v neck</a> <a href="http://www.findnewcoupon.com/nike-air-max-independence-day-red-buy-shoesi">nike air max independence day red buy</a>
clickstroy http://www.clickstroy.com/
lagunawoodsre
 lagunawoodsre 2019-03-19 22:24回复
#116
<a href="http://www.tmzred.com/nike-kd-7-kvinners-hvit-gull-obuvi">nike kd 7 kvinners hvit gull</a> <a href="http://www.alcovozov.com/adidas-neo-honeycomb-naranja-negro-zapatosp">adidas neo honeycomb naranja negro</a> <a href="http://www.ahmztradefx.com/nike-kobe-9-kvinders-guld-lilla-skol">nike kobe 9 kvinders guld lilla</a> <a href="http://www.isampled.com/nike-air-max-2017-femminile-gituttio-nero-scarpeh">nike air max 2017 femminile gituttio nero</a> <a href="http://www.aldervets.com/nike-free-run-3-maschio-grigio-scarpei">nike free run 3 maschio grigio</a> <a href="http://www.vanltl.com/dam%C3%A4nner-nike-air-max-tailwind-7-rosa-wei%C3%9F-schuheh">dam盲nner nike air max tailwind 7 rosa wei脽</a>
lagunawoodsre http://www.lagunawoodsre.com/
primarknorway
 primarknorway 2019-03-19 20:32回复
#115
<a href="http://www.wtaarchitects.com/hommes-nike-roshe-run-triangle-or-rose-scarpef">hommes nike roshe run triangle or rose</a> <a href="http://www.bibleofpeace.com/nfl-ronnie-harrison-youth-limited-black-jersey-36-jacksonville-jaguars-nike-therma-long-sleeve-nfls">nfl ronnie harrison youth limited black jersey 36 jacksonville jaguars nike therma long sleeve</a> <a href="http://www.thepinpress.com/hommes-teal-polo-shirt-polot">hommes teal polo shirt</a> <a href="http://www.fhnconference.com/nfl-mens-carolina-panthers-nike-black-super-bowl-50-bound-team-travel-performance-pullover-hoodie-nflz">nfl mens carolina panthers nike black super bowl 50 bound team travel performance pullover hoodie</a> <a href="http://www.haerinonghyup.com/nike-air-yeezy-2-kanye-west-r%C3%B8d-october-yeezy-kurpesd">nike air yeezy 2 kanye west r酶d october yeezy</a> <a href="http://www.burkkinc.com/nike-limited-shaquill-griffin-jersey-26-nfl-seattle-seahawks-2016-salute-to-service-youth-black-nflz">nike limited shaquill griffin jersey 26 nfl seattle seahawks 2016 salute to service youth black</a>
primarknorway http://www.primarknorway.com/
sethba
 sethba 2019-03-19 10:33回复
#114
<a href="http://www.diveintovideo.com/kd-9-hvid-and-r%C3%B8d-butyf">kd 9 hvid and r酶d</a> <a href="http://www.myhybridshop.com/nike-air-max-2016-azul-lagoon-lyrics-scarpea">nike air max 2016 azul lagoon lyrics</a> <a href="http://www.nrthofhere.com/air-max-lunar1-silber-wing-schuhec">air max lunar1 silber wing</a> <a href="http://www.torilsdesign.com/nike-air-max-2017-cuir-gray-noir-orange-quinoa-butye">nike air max 2017 cuir gray noir orange quinoa</a> <a href="http://www.bishoplitman.com/adidas-springblade-drive-2.0-plata-amarillo-butye">adidas springblade drive 2.0 plata amarillo</a> <a href="http://www.ksjfifgmif.com/jordan-11-cool-gr%C3%A5-back-obuve">jordan 11 cool gr氓 back</a>
sethba http://www.sethba.com/
prajansim
 prajansim 2019-03-18 06:58回复
#113
<a href="http://www.imfunniest.com/adidas-superstar-2-wei%C3%9F-schuhej">adidas superstar 2 wei脽</a> <a href="http://www.emissariesbc.com/herren-nike-huarache-utility-grau-schuhei">herren nike huarache utility grau</a> <a href="http://www.partnersspa.com/nike-internationalist-kvinners-rosa-bl%C3%A5-obuvj">nike internationalist kvinners rosa bl氓</a> <a href="http://www.antirealtor.com/tutti-nero-adidas-superstar-femminile-scarpel">tutti nero adidas superstar femminile</a> <a href="http://www.jkjuiceplus.com/air-jordan-eclipse-bleu-noir-chaussuresh">air jordan eclipse bleu noir</a> <a href="http://www.bkindvending.com/adidas-fg-soccer-boots-adipure-trx-nero-verde-scarpeh">adidas fg soccer boots adipure trx nero verde</a>
prajansim http://www.prajansim.com/
onpointresale
 onpointresale 2019-03-17 17:11回复
#112
<a href="http://www.polyphonyma.com/nike-darqueze-dennard-mens-white-game-jersey-21-nfl-road-cincinnati-bengals-nflw">nike darqueze dennard mens white game jersey 21 nfl road cincinnati bengals</a> <a href="http://www.shoeskiin.com/nike-air-max-tailwind-8-femminile-gituttio-viola-butyd">nike air max tailwind 8 femminile gituttio viola</a> <a href="http://www.bondhuberman.com/nike-kd-vii-big-b%C3%B8rn-guld-orange-kurpesc">nike kd vii big b酶rn guld orange</a> <a href="http://www.cbstriad.com/mens-ralph-lauren-tank-top-grey-khaki-polow">mens ralph lauren tank top grey khaki</a> <a href="http://www.feriadejaen.com/jordan-9-gr%C3%A5-hvid-and-sort-butye">jordan 9 gr氓 hvid and sort</a> <a href="http://www.gonencymm.com/ralph-lauren-pony-polo-rosa-braun-poloz">ralph lauren pony polo rosa braun</a>
[url=http://www.onpointresale.com/]onpointresale[/url]
berkshirerides
 berkshirerides 2019-03-17 16:43回复
#111
<a href="http://www.cosmonet.net/soccer-boots-nike-mercurial-superfly-cr7-lava-fg-sort-r%C3%B8d-hvid-kurpesa">soccer boots nike mercurial superfly cr7 lava fg sort r酶d hvid</a> <a href="http://www.cpgjoblist.net/mennns-nike-roshe-run-slip-gul-oransje-kurpesc">mennns nike roshe run slip gul oransje</a> <a href="http://www.crosswindschurch.net/adidas-protator-2014-xavi-obuva">adidas protator 2014 xavi</a> <a href="http://www.cuttingedgeoffers.net/air-jordan-super-fly-v-rosso-nero-schuhef">air jordan super fly v rosso nero</a> <a href="http://www.cvceurope.net/adidas-neo-bianca-scarpe-da-ginnastica-yoga-chaussuresg">adidas neo bianca scarpe da ginnastica yoga</a> <a href="http://www.cyberlec.net/nike-dunk-hvit-and-svart-obuvd">nike dunk hvit and svart</a>
berkshirerides http://www.berkshirerides.net/
cnttsx
 cnttsx 2019-03-17 15:26回复
#110
<a href="http://www.honardan.com/kyrie-2-university-rosso-cross-obuvf">kyrie 2 university rosso cross</a> <a href="http://www.honeymodas.com/ni%C3%B1os-zapatos-p%C3%BArpura-azul-schuhee">ni帽os zapatos p煤rpura azul</a> <a href="http://www.hookahbasics.com/nike-free-run-3.0-v5-blanc-obuvd">nike free run 3.0 v5 blanc</a> <a href="http://www.hosbeyinli.com/nike-lebron-12-grass-gr%C3%B8n-sort-gr%C3%A5-butye">nike lebron 12 grass gr酶n sort gr氓</a> <a href="http://www.hotelcantik.com/adidas-zx-flux-svart-with-rose-gull-obuvd">adidas zx flux svart with rose gull</a> <a href="http://www.houzall.com/nike-hypershift-sort-himmelbl%C3%A5-kurpesf">nike hypershift sort himmelbl氓</a>
cnttsx http://www.cnttsx.com/
mabarrel
 mabarrel 2019-03-16 15:52回复
#109
<a href="http://www.truthtapes.com/air-jordan-retro-9-dam%C3%A4nner-rosa-rot-schuhej">air jordan retro 9 dam盲nner rosa rot</a> <a href="http://www.veskopetrov.com/black-south-carolina-hat-hath">black south carolina hat</a> <a href="http://www.kaosmotogp.com/nike-soccers-chaussures-vert-bleu-ciel-chaussuresh">nike soccers chaussures vert bleu ciel</a> <a href="http://www.doularhythms.com/air-jordan-retro-4-brosso-bianca-scarpeq">air jordan retro 4 brosso bianca</a> <a href="http://www.animalpainvet.com/nike-shox-gray-black-shoesj">nike shox gray black</a> <a href="http://www.texarillo.com/air-jordan-phase-gr%C3%B8n-himmelbl%C3%A5-skoi">air jordan phase gr酶n himmelbl氓</a>
mabarrel http://www.mabarrel.com/
顶部留言底部
 00:00/00:00
我想和你虚度时光 - 花房姑娘(9)
  1. 我想和你虚度时光
  2. 花房姑娘
  3. 恋恋风尘
  4. 我喜爱一切不彻底的事物
  5. 我的心里是满的
  6. Long Way
  7. 给少年的歌
  8. 晴日共剪窗
  9. 天上的月你的脸