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

清空信息
关闭评论
oqibo
 oqibo 约 1 小时前回复
#192
<a href="http://www.yozushi.net/reebok-npc-uk-hvid-bl%C3%A5-butyc">reebok npc uk hvid bl氓</a> <a href="http://www.zionstrumpet.net/nike-lebron-11-low-negro-gum-for-venta-obuve">nike lebron 11 low negro gum for venta</a>
[url=http://www.oqibo.net/]oqibo[/url]
hummel ayakkab谋
 hummel ayakkab谋 约 2 小时前回复
#191
<a href="http://www.aarkaymovies.com/television/black-2013-china-best-professional-makeup-brush-set-wood-handle-custom-logo-makeup-brushes-brush-32-piece">black 2013 china best professional makeup brush set wood handle custom logo makeup brushes brush 32 piece</a><a href="http://www.aarkaymovies.com/together/buy-khadi-herbal-charcoal-face-wash-210ml-online-get-9-off">buy khadi herbal charcoal face wash 210ml online get 9 off</a><a href="http://www.aarkaymovies.com/town/give-a-ghd-gift-this-christmas-simon-townley">give a ghd gift this christmas simon townley</a><a href="http://www.aarkaymovies.com/training/curling-wand-5p-ceramic-hair-curler-curling-iron-cone-hair-styler-09-32mm-interchangable-multi-size-curling-iron-conical">curling wand 5p ceramic hair curler curling iron cone hair styler 09 32mm interchangable multi size curling iron conical</a>
hummel ayakkab谋 http://www.darlenepearson.com/progress/hummel-ayakkab%c4%b1
sunde pandekager
 sunde pandekager 2019-04-25 03:13回复
#190
<a href="http://www.tigernewsindia.com/away/lyser%c3%b8d-dameskjorte-pigeskjorte-i-smart-snit">lyser酶d dameskjorte pigeskjorte i smart snit</a><a href="http://www.tigernewsindia.com/bench/the-north-face-damet%c3%b8j-kvinder-shop-t%c3%b8j-til-kvinder-online-p%c3%a5">the north face damet酶j kvinder shop t酶j til kvinder online p氓</a><a href="http://www.tigernewsindia.com/blind/modebranchen-s%c3%a6tter-rekord-med-t%c3%b8jsalg-for-42-milliarder">modebranchen s忙tter rekord med t酶jsalg for 42 milliarder</a><a href="http://www.tigernewsindia.com/bring/danmark-m%c3%b8der-panama-i-testkamp-frem-mod-vm-tv-2">danmark m酶der panama i testkamp frem mod vm tv 2</a>
sunde pandekager http://www.tigernewsindia.com/common/sunde-pandekager
beautymotive
 beautymotive 2019-04-24 21:04回复
#189
<a href="http://www.hopitalhayek.com/jordan-air-1-rojo-zapatosl">jordan air 1 rojo</a> <a href="http://www.cheapartsale.com/mens-ray-ban-wayfarer-sunglasses-sunglassesh">mens ray ban wayfarer sunglasses</a> <a href="http://www.xjdscnuh.com/under-armour-sports-cap-hatj">under armour sports cap</a> <a href="http://www.cybcarusa.com/nike-internationalist-maschio-grigio-scarpej">nike internationalist maschio grigio</a> <a href="http://www.drfoxxdds.com/air-jordan-retro-1-rot-wei%C3%9F-blau-schuhei">air jordan retro 1 rot wei脽 blau</a> <a href="http://www.hagemannlaw.com/nike-foamposite-orange-and-sort-skoh">nike foamposite orange and sort</a>
beautymotive http://www.beautymotive.com/
twistnik
 twistnik 2019-04-23 15:05回复
#188
<a href="http://www.xescortx.com/nike-air-max-r%C3%B8d-and-hvit-obuvk">nike air max r酶d and hvit</a> <a href="http://www.naturabottega.com/nike-sb-stefan-janoski-max-nero-viola-bianca-scarpei">nike sb stefan janoski max nero viola bianca</a> <a href="http://www.peddlir.com/mujer-gel-quantum-360-azul-light-azul-volt-negro-zapatosh">mujer gel quantum 360 azul light azul volt negro</a> <a href="http://www.snowdaydc.com/wmns-nike-free-tr-flyknit-5.0-gr%C3%A5-skok">wmns nike free tr flyknit 5.0 gr氓</a> <a href="http://www.alliesindex.com/kvinners-nike-roshe-run-floral-gr%C3%A5-gull-obuvi">kvinners nike roshe run floral gr氓 gull</a> <a href="http://www.cafekem.com/comprar-todas-negro-converse-zapatosl">comprar todas negro converse</a>
twistnik http://www.twistnik.com/
enventsurvey
 enventsurvey 2019-04-23 11:21回复
#187
<a href="http://www.flushnhunt.com/air-jordan-son-of-mars-mint-green-yellow-shoesi">air jordan son of mars mint green yellow</a> <a href="http://www.evelpa.com/kvinders-asics-gel-lyte-5-appelsin-skoj">kvinders asics gel lyte 5 appelsin</a> <a href="http://www.taaliminfos.com/kvinners-nike-flyknit-lunar-3-hvit-svart-obuvi">kvinners nike flyknit lunar 3 hvit svart</a> <a href="http://www.cacikvideo.com/kvinners-nike-air-max-95-bl%C3%A5-hvit-obuvp">kvinners nike air max 95 bl氓 hvit</a> <a href="http://www.grossavind.com/kvinners-nike-air-force-1-high-himmelen-bl%C3%A5-obuvi">kvinners nike air force 1 high himmelen bl氓</a> <a href="http://www.boltsfans.com/aidas-boost-clima-chill-azul-blanco-zapatosp">aidas boost clima chill azul blanco</a>
enventsurvey http://www.enventsurvey.com/
dorothygrant
 dorothygrant 2019-04-21 18:45回复
#186
<a href="http://www.bursatiket.net/nike-lunarepic-low-flyknit-argent-gris-butyd">nike lunarepic low flyknit argent gris</a> <a href="http://www.buxpix.net/air-max-zapatillas-2014-hombres-obuvc">air max zapatillas 2014 hombres</a> <a href="http://www.buyggauto.net/air-jordan-future-kvinners-gul-himmelen-bl%C3%A5-kurpesf">air jordan future kvinners gul himmelen bl氓</a> <a href="http://www.carlinandcompany.net/air-jordan-28-se-dark-grau-yarn-kurpesa">air jordan 28 se dark grau yarn</a> <a href="http://www.carrymebike.net/nike-roshe-run-nm-woven-pueblo-rosso-chaussuresb">nike roshe run nm woven pueblo rosso</a> <a href="http://www.casatienda.net/lebron-12-gr%C3%B8nn-week-obuve">lebron 12 gr酶nn week</a>
dorothygrant http://www.dorothygrant.net/
calvarynola
 calvarynola 2019-04-21 05:54回复
#185
<a href="http://www.trancelater.net/air-jordan-4-rouge-noir-blanc-butya">air jordan 4 rouge noir blanc</a> <a href="http://www.uscampvictory.net/nike-hommes-free-4.0-flyknit-noir-photo-bleu-blanc-schuhea">nike hommes free 4.0 flyknit noir photo bleu blanc</a> <a href="http://www.veetracker.net/new-jordan-14-schwarz-toe-schuheb">new jordan 14 schwarz toe</a> <a href="http://www.velomini.net/herre-nike-roshe-yeezy-boost-orange-lyser%C3%B8d-butyc">herre nike roshe yeezy boost orange lyser酶d</a> <a href="http://www.voilahalla.net/air-max-97-marine-bleu-gun-obuvf">air max 97 marine bleu gun</a> <a href="http://www.walterinsurance.net/air-jordan-3-retro-rouge-jaune-key-obuvf">air jordan 3 retro rouge jaune key</a>
calvarynola http://www.calvarynola.net/
lovemescort
 lovemescort 2019-04-20 11:38回复
#184
<a href="http://www.viaggivaldata.com/nike-free-run-2-hommes-noir-vert-chaussuresh">nike free run 2 hommes noir vert</a> <a href="http://www.sasguukr.com/frau-nike-internationalist-jcrd-woven-schwarz-rosa-wei%C3%9F-schuheh">frau nike internationalist jcrd woven schwarz rosa wei脽</a> <a href="http://www.mobiigroups.com/nike-dunk-sky-hi-joli-black-shoesk">nike dunk sky hi joli black</a> <a href="http://www.alboths.com/m%C3%A6nd-adidas-climachill-gazelle-boost-royal-bl%C3%A5-gr%C3%A5-skoj">m忙nd adidas climachill gazelle boost royal bl氓 gr氓</a> <a href="http://www.woulee.com/herren-nike-flyknit-racer-blau-gr%C3%BCn-schuheh">herren nike flyknit racer blau gr眉n</a> <a href="http://www.ulriksdalssk.com/mens-adidas-springblade-ignite-grey-shoesk">mens adidas springblade ignite grey</a>
lovemescort http://www.lovemescort.com/
trionfodigalatea
 trionfodigalatea 2019-04-19 08:40回复
#183
<a href="http://www.lamtalia.net/nike-zoom-kobe-6-tout-star-utah-chaussuresa">nike zoom kobe 6 tout star utah</a> <a href="http://www.laydenrobinson.net/air-jordan-retro-4-schwarz-denim-butya">air jordan retro 4 schwarz denim</a> <a href="http://www.learningwrapups.net/air-jordan-retro-14-b%C3%B8rn-brun-s%C3%B8lv-scarpef">air jordan retro 14 b酶rn brun s酶lv</a> <a href="http://www.leclisse.net/nike-internationalist-wolf-grigio-team-arancia-cool-grigio-butyf">nike internationalist wolf grigio team arancia cool grigio</a> <a href="http://www.leddeckenleuchten.net/nike-air-max-90-hyperfuse-independence-day-dark-blu-butyf">nike air max 90 hyperfuse independence day dark blu</a> <a href="http://www.ledgallery.net/nike-darwin-360-rosso-schuhea">nike darwin 360 rosso</a>
trionfodigalatea http://www.trionfodigalatea.net/
顶部留言底部
 00:00/00:00
我想和你虚度时光 - 花房姑娘(9)
  1. 我想和你虚度时光
  2. 花房姑娘
  3. 恋恋风尘
  4. 我喜爱一切不彻底的事物
  5. 我的心里是满的
  6. Long Way
  7. 给少年的歌
  8. 晴日共剪窗
  9. 天上的月你的脸