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

迷津渡口

越感到迷惑 越接近真理

emlog MVC解构23--控制器Controller之Record_Controller

Record_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;
    // 获取归档日期,格式为年月或年月日,四位年,含前导零的月,含前导零的日,如201607或20160707
    $record = isset($params[1]) && $params[1] == 'record' ? intval($params[2]) : '' ;
    
    // 为了侧边栏的日历归档功能,将record设为全局变量
    $GLOBALS['record'] = $record;
    
    // 定义访问路径变量
    $pageurl = '';
    
    // 归档页面站点标题设置为归档日期-站点浏览器标题
    $site_title = $record . ' - ' . $site_title;
    
    // 单月归档和单日归档
    if (preg_match("/^([\d]{4})([\d]{2})$/", $record, $match)) {  // 单月归档
        // 获取当月的天数
        $days = getMonthDayNum($match[2], $match[1]);
        // 获取当月第一天开始的时间戳
        $record_stime = emStrtotime($record . '01');
        // 获取当月最后一天结束的时间戳
        $record_etime = $record_stime + 3600 * 24 * $days;
    } else { // 单日归档
        // 获取当天开始的时间戳
        $record_stime = emStrtotime($record);
        // 获取当天结束的时间戳
        $record_etime = $record_stime + 3600 * 24;
    }
    // 设置数据库查询条件为开始时间戳到结束时间戳,从新到旧排列
    $sqlSegment = "and date>=$record_stime and date<$record_etime order by date desc";
    // 获取满足条件已发布的日志总数量
    $lognum = $Log_Model->getLogNum('n', $sqlSegment);
    
    // 获取归档页面的总页数
    $total_pages = ceil($lognum / $index_lognum);
    if ($page > $total_pages) { // 页码超过总页数
        // 设置页码为最后一页
        $page = $total_pages;
    }
    // 非首页时查询的开始的界限
    $start_limit = ($page - 1) * $index_lognum;
    
    // 利用Url获取归档链接
    $pageurl .= Url::record($record, '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
   支持一下
挤眼 亲亲 咆哮 开心 想想 可怜 糗大了 委屈 哈哈 小声点 右哼哼 左哼哼 疑问 坏笑 赚钱啦 悲伤 耍酷 勾引 厉害 握手 耶 嘻嘻 害羞 鼓掌 馋嘴 抓狂 抱抱 围观 威武 给力
 点赞
 签到
 表情
 图片
 代码
提交评论

清空信息
关闭评论
kidtokidboise
 kidtokidboise 2019-02-14 13:00回复
#82
<a href="http://www.eworklife.com/cheap-under-armour-curry-2-mens-grey-skoa">cheap under armour curry 2 mens grey</a> <a href="http://www.fullcountkbo.com/red-pink-womens-adidas-falcon-elite-shoes-sneakere">red pink womens adidas falcon elite shoes</a> <a href="http://www.shackofstones.com/nike-air-max-bw-gr%C3%A5-lyser%C3%B8d-kurpesa">nike air max bw gr氓 lyser酶d</a> <a href="http://www.tamworthbacon.com/nike-air-max-thea-atomic-pink-zalando-sneakerb">nike air max thea atomic pink zalando</a> <a href="http://www.dvmengineers.com/air-max-thea-womens-glow-shoesg">air max thea womens glow</a> <a href="http://www.questoffine.com/arizona-cardinals-bobble-hat-hats">arizona cardinals bobble hat</a>
kidtokidboise http://www.kidtokidboise.com/
cestreaming
 cestreaming 2019-02-13 12:31回复
#81
<a href="http://www.keleric.com/nike-zoom-pegasus-31-sky-blue-yellow-shoesl">nike zoom pegasus 31 sky blue yellow</a> <a href="http://www.jeffreya.com/amari-cooper-signed-jersey-nfli">amari cooper signed jersey</a> <a href="http://www.vuduchoan.com/adidas-neo-campus-gul-himmelen-bl%C3%A5-obuvk">adidas neo campus gul himmelen bl氓</a> <a href="http://www.gmfamilylaw.com/coach-tote-rose-stone-coachh">coach tote rose stone</a> <a href="http://www.clubephytus.com/femminile-nike-cortez-oro-viola-scarpei">femminile nike cortez oro viola</a> <a href="http://www.findnewcoupon.com/adidas-neo-honeycomb-blu-arancia-scarpeh">adidas neo honeycomb blu arancia</a>
cestreaming http://www.cestreaming.com/
wei脽 polo t shirt
 wei脽 polo t shirt 2019-02-11 08:17回复
#80
<a href="http://www.devinpowell.com/adidas-originals-gazelle-ii-skot">adidas originals gazelle ii</a> <a href="http://www.empresainnova.com/nike-internationalist-sunset-tint-cool-grey-valley-trainerse">nike internationalist sunset tint cool grey valley</a> <a href="http://www.grifeyescoda.com/nike-air-foamposite-pro-retro-electric-blau-chaussuresa">nike air foamposite pro retro electric blau</a> <a href="http://www.oldiesdigital.com/nike-flyknit-racer-turquoise-flynit-footf">nike flyknit racer turquoise flynit</a> <a href="http://www.gamexpedition.com/polo-hombres-zip-up-sweater-polo_m">polo hombres zip up sweater</a> <a href="http://www.tedkanavas.com/nfl-harrison-butker-womens-red-7-kansas-city-chiefs-nike-backer-t-shirt-nflt">nfl harrison butker womens red 7 kansas city chiefs nike backer t shirt</a>
[url=http://www.cokhithinhanh.com/wei%C3%9F-polo-t-shirt-polor]wei脽 polo t shirt[/url]
cooterscamera
 cooterscamera 2019-02-10 12:46回复
#79
<a href="http://www.mumbaikichut.com/nike-free-run-light-gr%C3%B8nn-obuvi">nike free run light gr酶nn</a> <a href="http://www.ikmsdkravmaga.com/nike-air-force-1-nero-downtown-scarpej">nike air force 1 nero downtown</a> <a href="http://www.themusinglens.com/nike-kobe-5-green-black-shoesh">nike kobe 5 green black</a> <a href="http://www.startagencia.com/nike-kd-7-gris-amarillo-zapatosp">nike kd 7 gris amarillo</a> <a href="http://www.drjennieward.com/nike-zoom-vomero-mujeres-cielo-azul-rosado-zapatosk">nike zoom vomero mujeres cielo azul rosado</a> <a href="http://www.genievres.com/the-north-face-denali-fleece-northfaceh">the north face denali fleece</a>
cooterscamera http://www.cooterscamera.com/
dulcemusa
 dulcemusa 2019-02-10 10:08回复
#78
<a href="http://www.ambitionagent.com/air-jordan-retro-5-hvit-butye">air jordan retro 5 hvit</a> <a href="http://www.brensonford.com/air-jordan-7-retro-gg-hyper-rosa-roshe-kurpesc">air jordan 7 retro gg hyper rosa roshe</a> <a href="http://www.dutting.com/femmes-ralph-lauren-mesh-polo-rouge-gris-polow">femmes ralph lauren mesh polo rouge gris</a> <a href="http://www.erickasouza.com/adidas-porsche-leisure-svart-gr%C3%A5-butyf">adidas porsche leisure svart gr氓</a> <a href="http://www.flyboardbc.com/ralph-lauren-cotton-graphic-tee-in-arancia-poloz">ralph lauren cotton graphic tee in arancia</a> <a href="http://www.mommypads.com/nike-shox-current-bleu-ciel-chaussuresf">nike shox current bleu ciel</a>
dulcemusa http://www.dulcemusa.com/
frijlan
 frijlan 2019-02-09 08:49回复
#77
<a href="http://www.pedtrauma.com/nike-free-v4-maschio-verde-sportse">nike free v4 maschio verde</a> <a href="http://www.bettytatar.com/nike-air-max-2015-jade-runningd">nike air max 2015 jade</a> <a href="http://www.schiffsamplea.com/elite-logan-ryan-jersey-new-england-patriots-super-bowl-xlix-26-home-navy-blue-nflg">elite logan ryan jersey new england patriots super bowl xlix 26 home navy blue</a> <a href="http://www.trueaustinpg.com/adidas-neo-all-white-queen-skoa">adidas neo all white queen</a> <a href="http://www.pitcrewcooks.com/nike-free-4.0-v2-kvinders-gr%C3%B8n-runningd">nike free 4.0 v2 kvinders gr酶n</a> <a href="http://www.hepseninle.com/kyrie-2-easter-nike-basketball-runningf">kyrie 2 easter nike basketball</a>
frijlan http://www.frijlan.com/
nvusforex
 nvusforex 2019-02-09 03:00回复
#76
<a href="http://www.culturalsq.com/jordan-6-ghost-green-low-infrared-runninge">jordan 6 ghost green low infrared</a> <a href="http://www.tiaracara.com/nike-air-max-tailwind-6-gr%C3%A5-himmelbl%C3%A5-schuhea">nike air max tailwind 6 gr氓 himmelbl氓</a> <a href="http://www.shaunasbags.com/adidas-zx-flux-2.0-gris-scarpeb">adidas zx flux 2.0 gris</a> <a href="http://www.tomtaylorblog.com/nike-air-max-2019-green-uk-shoeso">nike air max 2019 green uk</a> <a href="http://www.pistonari.com/nike-free-run-5.0-v2-orange-noir-jaune-kurpesb">nike free run 5.0 v2 orange noir jaune</a> <a href="http://www.rebeccastaste.com/jordan-book-bags-for-boys-zapatost">jordan book bags for boys</a>
nvusforex http://www.nvusforex.com/
inckua
 inckua 2019-02-09 01:50回复
#75
<a href="http://www.chaiwanmei.com/nike-limited-mens-pittsburgh-steelers-84-antonio-brown-80th-anniversary-throwback-nfl-jersey-89.99-nflv">nike limited mens pittsburgh steelers 84 antonio brown 80th anniversary throwback nfl jersey 89.99</a> <a href="http://www.normazlin.com/barato-nike-air-max-thea-mujeres-p%C3%BArpura-shoesg">barato nike air max thea mujeres p煤rpura</a> <a href="http://www.pikapnsk.com/womens-nike-free-tr-flyknit-5.0-beige-shoesb">womens nike free tr flyknit 5.0 beige</a> <a href="http://www.chateaudefous.com/parajumpers-gobi-navy-parajumpersr">parajumpers gobi navy</a> <a href="http://www.kristyhuston.com/coach-bag-black-and-gray-coachr">coach bag black and gray</a> <a href="http://www.gstavrakakis.com/2014-15-real-madrid-2-varane-away-pink-soccer-long-sleeve-shirt-kit-nflv">2014 15 real madrid 2 varane away pink soccer long sleeve shirt kit</a>
inckua http://www.inckua.com/
zlotyul
 zlotyul 2019-02-07 20:59回复
#74
<a href="http://www.ultimatetd.com/air-jordan-retro-10-cielo-azul-brojo-scarpea">air jordan retro 10 cielo azul brojo</a> <a href="http://www.unvailevents.com/nike-roshe-flyknit-wolf-gris-pure-platinum-schuheb">nike roshe flyknit wolf gris pure platinum</a> <a href="http://www.virgocity.com/nike-free-3.0-v5-femmes-noir-label-butyf">nike free 3.0 v5 femmes noir label</a> <a href="http://www.ycbrowsbeauty.com/adidas-springblade-solyce-noir-marron-butyf">adidas springblade solyce noir marron</a> <a href="http://www.gfatraining.com/nike-kobe-11-flyknit-rosado-blanco-obuvf">nike kobe 11 flyknit rosado blanco</a> <a href="http://www.karenannelevo.com/nike-zoom-train-action-gr%C3%A5-lilla-obuve">nike zoom train action gr氓 lilla</a>
zlotyul http://www.zlotyul.com/
melbabishop
 melbabishop 2019-02-07 14:07回复
#73
<a href="http://www.scottdepot.com/herren-nike-roshe-run-hyp-gr%C3%BCn-chaussuresd">herren nike roshe run hyp gr眉n</a> <a href="http://www.troyafolklor.com/nike-free-motion-flyknit-in-esecuzione-scarpe-butyg">nike free motion flyknit in esecuzione scarpe</a> <a href="http://www.ampflightads.com/adidas-john-walle-2-dark-bl%C3%A5-hvid-scarpea">adidas john walle 2 dark bl氓 hvid</a> <a href="http://www.edotokyolabo.com/a-buon-mercato-nike-5.0-in-esecuzione-scarpe-schuheb">a buon mercato nike 5.0 in esecuzione scarpe</a> <a href="http://www.euniscpa.com/nike-free-flyknit-5.0-kvinders-himmelbl%C3%A5-bl%C3%A5-butyf">nike free flyknit 5.0 kvinders himmelbl氓 bl氓</a> <a href="http://www.governisation.com/herre-air-max-90-sneakerboot-lyser%C3%B8d-gr%C3%A5-butye">herre air max 90 sneakerboot lyser酶d gr氓</a>
melbabishop http://www.melbabishop.com/
顶部留言底部
 00:00/00:00
我想和你虚度时光 - 花房姑娘(9)
  1. 我想和你虚度时光
  2. 花房姑娘
  3. 恋恋风尘
  4. 我喜爱一切不彻底的事物
  5. 我的心里是满的
  6. Long Way
  7. 给少年的歌
  8. 晴日共剪窗
  9. 天上的月你的脸