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

清空信息
关闭评论
sonic hat
 sonic hat 2019-05-22 06:28回复
#239
<a href="http://www.edutechnews.com/than/abstand-m%c3%a4nner-kleidung-2018-fr%c3%bchling-jacken-m%c3%a4nner-baumwolle-stehen-kragen-brief-stickerei-milit%c3%a4rischen-jacke-mantel-mittleren">abstand m盲nner kleidung 2018 fr眉hling jacken m盲nner baumwolle stehen kragen brief stickerei milit盲rischen jacke mantel mittleren</a><a href="http://www.edutechnews.com/thong/schwarz-wei%c3%9f-kleid-60-viskose-s.oliver-damen-kleidung">schwarz wei脽 kleid 60 viskose s.oliver damen kleidung</a><a href="http://www.edutechnews.com/tourist/adidas-schuhe-damen-online-shop">adidas schuhe damen online shop</a><a href="http://www.edutechnews.com/whereas/online-shop-f%c3%bcr-nike-air-presto-frauen-schuhe-gr%c3%bcn">online shop f眉r nike air presto frauen schuhe gr眉n</a>
sonic hat http://www.gomoviereview.com/diet/sonic-hat
kentimpendik
 kentimpendik 2019-05-22 04:13回复
#238
<a href="http://www.setusoftware.com/north-face-apex-bionic-jacket-mens-cheap-northfaceh">north face apex bionic jacket mens cheap</a> <a href="http://www.shopteamcubs.com/adidas-neo-white-high-tops-shoesh">adidas neo white high tops</a> <a href="http://www.danieldavinci.com/femmes-nike-air-max-90-noir-chaussuresl">femmes nike air max 90 noir</a> <a href="http://www.lovirani.com/womens-black-high-top-converse-on-sale-shoesj">womens black high top converse on sale</a> <a href="http://www.rosebites.com/pittsburgh-pirates-47-mlb-camfill-neon-snapback-cap-hatk">pittsburgh pirates 47 mlb camfill neon snapback cap</a> <a href="http://www.webrushllc.com/dark-lyser%C3%B8d-converse-skoj">dark lyser酶d converse</a>
kentimpendik http://www.kentimpendik.com/
realchiyouth
 realchiyouth 2019-05-21 20:10回复
#237
<a href="http://www.hkyahao.com/odell-beckham-youth-jersey-white-nflh">odell beckham youth jersey white</a> <a href="http://www.innordicau.com/nike-huarache-blanco-pure-platinum-shoese">nike huarache blanco pure platinum</a> <a href="http://www.rahdanesh.com/lyst-polo-ralph-lauren-oxford-check-shirt-in-red-for-men-poloh">lyst polo ralph lauren oxford check shirt in red for men</a> <a href="http://www.myprontocard.com/nike-sock-dart-sp-dam%C3%A4nner-wei%C3%9F-foota">nike sock dart sp dam盲nner wei脽</a> <a href="http://www.eldiadeitalia.com/air-jordan-7-retro-j2k-for-verkauf-craigslist-runninga">air jordan 7 retro j2k for verkauf craigslist</a> <a href="http://www.lapakhoki.com/nike-air-huarache-military-verde-arrow-scarpef">nike air huarache military verde arrow</a>
realchiyouth http://www.realchiyouth.com/
culdesacmag
 culdesacmag 2019-05-21 16:04回复
#236
<a href="http://www.lagunawoodsre.com/adidas-springblade-ignite-bleu-ciel-blanc-chaussuresh">adidas springblade ignite bleu ciel blanc</a> <a href="http://www.highbacklink.com/colorado-fishing-hat-hatl">colorado fishing hat</a> <a href="http://www.vuurogen.com/air-jordan-retro-11-jaune-gris-chaussuresh">air jordan retro 11 jaune gris</a> <a href="http://www.rsvppersonnel.com/free-og-14-br-todas-amarillo-zapatosp">free og 14 br todas amarillo</a> <a href="http://www.shonema.com/womens-nike-lunarglide-7-black-grey-shoesi">womens nike lunarglide 7 black grey</a> <a href="http://www.enventsurvey.com/nike-flyknit-lunar-3-dam%C3%A4nner-himmelblau-wei%C3%9F-schuhei">nike flyknit lunar 3 dam盲nner himmelblau wei脽</a>
[url=http://www.culdesacmag.com/]culdesacmag[/url]
bethelpipe
 bethelpipe 2019-05-21 14:51回复
#235
<a href="http://www.dvdlivedoor.com/nike-city-sandal-ii-barn-gull-gr%C3%A5-schuhee">nike city sandal ii barn gull gr氓</a> <a href="http://www.exterminas.com/lebron-12-data-vendita-foote">lebron 12 data vendita</a> <a href="http://www.filoliteafarm.com/kd-9-wolf-grigio-nero-skof">kd 9 wolf grigio nero</a> <a href="http://www.shalandaleigh.com/new-york-yankees-jersey-grey-nflh">new york yankees jersey grey</a> <a href="http://www.skepticmoment.com/jackie-bradley-jr-jersey-nfli">jackie bradley jr jersey</a> <a href="http://www.kleankampsite.com/earl-thomas-green-jersey-nflh">earl thomas green jersey</a>
bethelpipe http://www.bethelpipe.com/
iseejanemary
 iseejanemary 2019-05-21 12:10回复
#234
<a href="http://www.araricambi.com/short-roxy-ugg-boots-uggsr">short roxy ugg boots</a> <a href="http://www.paulacorley.com/adidas-tubular-runner-khaki-skou">adidas tubular runner khaki</a> <a href="http://www.lbsportsguys.com/bon-march%C3%A9-nike-kobe-8-hommes-argent-shoesa">bon march茅 nike kobe 8 hommes argent</a> <a href="http://www.iraqbody.com/snapback-new-era-9fifty-hatr">snapback new era 9fifty</a> <a href="http://www.debbiebissett.com/air-jordan-6-retro-low-white-university-blue-light-trainersa">air jordan 6 retro low white university blue light</a> <a href="http://www.michellestill.com/adidas-porsche-typ-64-blue-purple-skof">adidas porsche typ 64 blue purple</a>
iseejanemary http://www.iseejanemary.com/
rdjanitorial
 rdjanitorial 2019-05-21 10:11回复
#233
<a href="http://www.cnovas.com/dam%C3%A4nner-air-max-90-em-wei%C3%9F-rosa-schuheh">dam盲nner air max 90 em wei脽 rosa</a> <a href="http://www.omnicitycorp.com/kvinners-adidas-zx-750-royal-bl%C3%A5-obuvj">kvinners adidas zx 750 royal bl氓</a> <a href="http://www.cmcheechalk.com/nike-roshe-run-floreale-oro-verde-scarpek">nike roshe run floreale oro verde</a> <a href="http://www.armandopaz.com/femmes-nike-zoom-pegasus-33-gris-noir-chaussuresh">femmes nike zoom pegasus 33 gris noir</a> <a href="http://www.alrightdesign.com/prada-bn4653-handbags-in-black-41-pradah">prada bn4653 handbags in black 41</a> <a href="http://www.parksindust.com/cincinnati-bengals-youth-jersey-nfli">cincinnati bengals youth jersey</a>
rdjanitorial http://www.rdjanitorial.com/
imagimp
 imagimp 2019-05-21 05:35回复
#232
<a href="http://www.wuxiangtaichi.com/air-jordan-retro-10-kvinners-himmelen-bl%C3%A5-s%C3%B8lv-obuvl">air jordan retro 10 kvinners himmelen bl氓 s酶lv</a> <a href="http://www.culdesacmag.com/air-jordan-3-retro-lyser%C3%B8d-skoj">air jordan 3 retro lyser酶d</a> <a href="http://www.livinggreedy.com/femminile-nike-zoom-pegasus-31-bianca-oro-scarpel">femminile nike zoom pegasus 31 bianca oro</a> <a href="http://www.clickstroy.com/womens-nike-air-max-tailwind-6-blue-gold-shoesj">womens nike air max tailwind 6 blue gold</a> <a href="http://www.zotorrent.com/air-jordan-retro-13-lilla-s%C3%B8lv-skok">air jordan retro 13 lilla s酶lv</a> <a href="http://www.viptarimas.com/air-jordan-retro-11-rosa-mint-gr%C3%B8nn-obuvp">air jordan retro 11 rosa mint gr酶nn</a>
imagimp http://www.imagimp.com/
ankaralimnet
 ankaralimnet 2019-05-20 22:03回复
#231
<a href="http://www.whatoiljobs.com/adidas-ace-16.3-negro-and-naranja-zapatosh">adidas ace 16.3 negro and naranja</a> <a href="http://www.mustberavi.com/nike-air-max-bw-premium-team-r%C3%B8d-vachetta-tan-skok">nike air max bw premium team r酶d vachetta tan</a> <a href="http://www.dynamixawards.com/nike-sb-dunk-low-pro-obsidian-hvit-obuvi">nike sb dunk low pro obsidian hvit</a> <a href="http://www.nerdalertnews.com/nike-air-max-90-kpu-tpu-hombres-marr%C3%B3n-amarillo-zapatosl">nike air max 90 kpu tpu hombres marr贸n amarillo</a> <a href="http://www.dmvantalya.com/ray-ban-rb3026-62-sunglassesh">ray ban rb3026 62</a> <a href="http://www.houshyaree.com/new-york-yankees-new-era-2018-mlb-st.-patricks-day-prolight-59fifty-cap-hatj">new york yankees new era 2018 mlb st. patricks day prolight 59fifty cap</a>
ankaralimnet http://www.ankaralimnet.com/
mxclimited
 mxclimited 2019-05-18 20:25回复
#230
<a href="http://www.dastforoush.com/samba-gr%C3%BCn-adidas-schuhej">samba gr眉n adidas</a> <a href="http://www.etxekalte.com/nike-free-3.0-v6-ext-frau-schwarz-gr%C3%BCn-grau-schuhei">nike free 3.0 v6 ext frau schwarz gr眉n grau</a> <a href="http://www.tumbhimall.com/menn-nike-zoom-kobe-9-r%C3%B8d-hvit-svart-obuvj">menn nike zoom kobe 9 r酶d hvit svart</a> <a href="http://www.formulaforfun.com/adidas-ultra-boost-triple-bianca-2-scarpel">adidas ultra boost triple bianca 2</a> <a href="http://www.icallvoters.com/hommes-nike-air-huarache-nm-rose-bleu-chaussuresh">hommes nike air huarache nm rose bleu</a> <a href="http://www.megadomenl.com/air-jordan-12-retro-rosso-and-nero-scarpeh">air jordan 12 retro rosso and nero</a>
mxclimited http://www.mxclimited.com/
顶部留言底部
 00:00/00:00
我想和你虚度时光 - 花房姑娘(9)
  1. 我想和你虚度时光
  2. 花房姑娘
  3. 恋恋风尘
  4. 我喜爱一切不彻底的事物
  5. 我的心里是满的
  6. Long Way
  7. 给少年的歌
  8. 晴日共剪窗
  9. 天上的月你的脸