当前位置: 首页>>代码示例>>PHP>>正文


PHP Posts::ascend方法代码示例

本文整理汇总了PHP中Posts::ascend方法的典型用法代码示例。如果您正苦于以下问题:PHP Posts::ascend方法的具体用法?PHP Posts::ascend怎么用?PHP Posts::ascend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Posts的用法示例。


在下文中一共展示了Posts::ascend方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: js

    private function js($theme)
    {
        // If there's a single post, ascend or descend appropriately
        if ($theme->posts instanceof Post) {
            $next = Posts::ascend($theme->posts)->permalink;
            $previous = Posts::descend($theme->posts)->permalink;
        } else {
            $page = $theme->page;
            $items_per_page = isset($theme->posts->get_param_cache['limit']) ? $theme->posts->get_param_cache['limit'] : Options::get('pagination');
            $total = Utils::archive_pages($theme->posts->count_all(), $items_per_page);
            if ($page + 1 > $total) {
                $next = '';
            } else {
                $next = URL::get(null, array('page' => $page + 1));
            }
            if ($page - 1 < 1) {
                $previous = '';
            } else {
                $previous = URL::get(null, array('page' => $page - 1));
            }
        }
        $delay = Options::get('key_nav_delay');
        $selector = Options::get('key_nav_selector');
        return <<<KEYNAV
\$(document).ready(function() {
\tcurrent = 0;
\t\$.hotkeys.add('j', {propagate:true, disableInInput: true}, function(){
\t\tif (current == \$('{$selector}').length-1) {
\t\t\tif ('{$next}' == '') {
\t\t\t\t// TODO Show the no more posts message
\t\t\t} else {
\t\t\t\t// go to next page
\t\t\t\twindow.location = '{$next}';
\t\t\t}

\t\t} else {
\t\t\ttarget = \$('{$selector}').eq(current+1).offset().top
\t\t\t\$('html,body').animate({scrollTop: target}, {$delay});
\t\t\tcurrent++;
\t\t}
\t});
\t\$.hotkeys.add('k', {propagate:true, disableInInput: true}, function(){
\t\tif (current == 0) {
\t\t\tif ('{$previous}' == '') {
\t\t\t\t// Show the no more posts message
\t\t\t} else {
\t\t\t\t// go to previous page
\t\t\t\twindow.location = '{$previous}';
\t\t\t}
\t\t} else {
\t\t\ttarget = \$('{$selector}').eq(current-1).offset().top
\t\t\t\$('html,body').animate({scrollTop: target}, {$delay});
\t\t\tcurrent--;
\t\t}
\t});
});
KEYNAV;
    }
开发者ID:habari-extras,项目名称:key_navigation,代码行数:58,代码来源:key_navigation.plugin.php

示例2: ascend

	/**
	 * Returns the ascending post, relative to this post, according to params
	 * @params The params by which to work out what is the ascending post
	 * @return Post The ascending post
	 */
	public function ascend( $params = null )
	{
		return Posts::ascend( $this, $params );
	}
开发者ID:rynodivino,项目名称:system,代码行数:9,代码来源:post.php


注:本文中的Posts::ascend方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。