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


PHP has_pagination函数代码示例

本文整理汇总了PHP中has_pagination函数的典型用法代码示例。如果您正苦于以下问题:PHP has_pagination函数的具体用法?PHP has_pagination怎么用?PHP has_pagination使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: config

     $page = $page ? (int) $page : 1;
     $perpage = config('posts.perpage');
     $posts = get_posts(null, $page, $perpage);
     $total = '';
     $tl = blog_tagline();
     if ($tl) {
         $tagline = ' - ' . $tl;
     } else {
         $tagline = '';
     }
     if (empty($posts) || $page < 1) {
         // a non-existing page
         render('no-posts', array('title' => 'Blog - ' . blog_title(), 'description' => blog_title() . ' Blog Homepage', 'canonical' => site_url(), 'bodyclass' => 'noposts', 'is_front' => true));
         die;
     }
     render('main', array('title' => 'Blog - ' . blog_title(), 'description' => blog_title() . ' Blog Homepage', 'canonical' => site_url() . 'blog', 'page' => $page, 'posts' => $posts, 'bodyclass' => 'inblog', 'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Blog', 'pagination' => has_pagination($total, $perpage, $page), 'is_blog' => true));
 } elseif ($static === 'front') {
     $redir = site_url();
     header("location: {$redir}", TRUE, 301);
 } else {
     if (config("views.counter") != "true") {
         if (!login()) {
             file_cache($_SERVER['REQUEST_URI']);
         }
     }
     $post = get_static_post($static);
     if (!$post) {
         not_found();
     }
     $post = $post[0];
     if (config("views.counter") == "true") {
开发者ID:robihidayat,项目名称:htmly,代码行数:31,代码来源:htmly.php

示例2: article_author

        ?>
</time> by <?php 
        echo article_author('real_name');
        ?>
.
                          </footer>
                        </article>
                        <hr>
                      </li>
                      <?php 
    }
    ?>
                    </ul>

                    <?php 
    if (has_pagination()) {
        ?>
                    <nav class="pagination">
                      <div class="wrap">
                        <?php 
        echo posts_prev();
        ?>
                        <?php 
        echo posts_next();
        ?>
                      </div>
                    </nav>
                    <?php 
    }
    ?>
开发者ID:Justin417,项目名称:SimpleBlogDesign,代码行数:30,代码来源:posts.php

示例3: get

// The search page
get('/search/:keyword', function ($keyword) {
    if (!login()) {
        file_cache($_SERVER['REQUEST_URI']);
    }
    $page = from($_GET, 'page');
    $page = $page ? (int) $page : 1;
    $perpage = config('search.perpage');
    $posts = get_keyword($keyword, $page, $perpage);
    $total = keyword_count($keyword);
    if (empty($posts) || $page < 1) {
        // a non-existing page
        render('404-search', null, false);
        die;
    }
    render('main', array('head_contents' => head_contents('Search results for: ' . $keyword . ' - ' . blog_title(), 'Search results for: ' . $keyword . ' on ' . blog_title() . '.', site_url() . 'search/' . $keyword), 'page' => $page, 'posts' => $posts, 'bodyclass' => 'insearch', 'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Search results for: ' . $keyword, 'pagination' => has_pagination($total, $perpage, $page)));
});
// The JSON API
get('/api/json', function () {
    header('Content-type: application/json');
    $page = from($_GET, 'page');
    $page = $page ? (int) $page : 1;
    $perpage = config('json.count');
    echo generate_json(get_posts(null, $page, $perpage));
});
// Show the RSS feed
get('/feed/rss', function () {
    header('Content-Type: application/rss+xml');
    // Show an RSS feed with the 30 latest posts
    echo generate_rss(get_posts(null, 1, config('rss.count')));
});
开发者ID:EricGhildyal,项目名称:ergh.co-Backend,代码行数:31,代码来源:htmly.php

示例4: config

// and our functions.php file
require 'app/includes/dispatch.php';
require 'app/includes/functions.php';
// Load the configuration file
config('source', 'app/config.ini');
// The front page of the blog.
// This will match the root url
get('/index', function () {
    $page = from($_GET, 'page');
    $page = $page ? (int) $page : 1;
    $posts = get_posts($page);
    if (empty($posts) || $page < 1) {
        // a non-existing page
        not_found();
    }
    render('main', array('page' => $page, 'posts' => $posts, 'has_pagination' => has_pagination($page)));
});
// The post page
get('/:year/:month/:name', function ($year, $month, $name) {
    $post = find_post($year, $month, $name);
    if (!$post) {
        not_found();
    }
    render('post', array('title' => $post->title . ' ⋅ ' . config('blog.title'), 'p' => $post));
});
// The JSON API
get('/api/json', function () {
    header('Content-type: application/json');
    // Print the 10 latest posts as JSON
    echo generate_json(get_posts(1, 10));
});
开发者ID:Zonewow,项目名称:zonewow.github.io,代码行数:31,代码来源:index.php

示例5: get

// Show the search page
get('/search/:keyword', function ($keyword) {
    if (!login()) {
        file_cache($_SERVER['REQUEST_URI']);
    }
    $page = from($_GET, 'page');
    $page = $page ? (int) $page : 1;
    $perpage = config('search.perpage');
    $posts = get_keyword($keyword, $page, $perpage);
    $total = keyword_count($keyword);
    if (empty($posts) || $page < 1) {
        // a non-existing page
        render('404-search', null, false);
        die;
    }
    render('main', array('title' => 'Search results for: ' . $keyword . ' - ' . blog_title(), 'description' => 'Search results for: ' . $keyword . ' on ' . blog_title() . '.', 'canonical' => site_url() . 'search/' . $keyword, 'page' => $page, 'posts' => $posts, 'bodyclass' => 'insearch', 'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> &#187; Search results for: ' . $keyword, 'pagination' => has_pagination($total, $perpage, $page), 'is_search' => is_search(true)));
});
// The JSON API
get('/api/json', function () {
    header('Content-type: application/json');
    $page = from($_GET, 'page');
    $page = $page ? (int) $page : 1;
    $perpage = config('json.count');
    echo generate_json(get_posts(null, $page, $perpage));
});
// Show the RSS feed
get('/feed/rss', function () {
    header('Content-Type: application/rss+xml');
    // Show an RSS feed with the 30 latest posts
    echo generate_rss(get_posts(null, 1, config('rss.count')));
});
开发者ID:andreaspada,项目名称:htmly,代码行数:31,代码来源:htmly.php

示例6: function

# 路由
#####################################################
$app->get('/test', function () use($app) {
    $Parsedown = new Parsedown();
    echo $Parsedown->parse('');
})->name('test');
#主页
$app->get('/', function () use($app) {
    $app->render('welcome.html');
});
$app->get('/home(/:page)', function ($page = 1) use($app) {
    $posts = get_posts($page);
    if (empty($posts) || $page < 1) {
        $app->notFound();
    }
    $app->render('index.html', ['page' => $page, 'posts' => $posts, 'has_pagination' => has_pagination($page)]);
})->conditions(array('page' => '[0-9]*'));
# Posts页
$app->get('/:year/:month/:name', function ($year, $month, $name) use($app) {
    $post = find_post($year, $month, $name);
    if (!$post) {
        $app->notFound();
    }
    $app->render('post.html', ['post' => $post]);
});
# 生成rss
$app->get('/rss', function () use($app) {
    $app->response->headers->set('Content-Type', 'application/rss+xml');
    echo generate_rss(get_posts(1, 30));
});
# 非法页面
开发者ID:sky-L,项目名称:LBlog-Slim,代码行数:31,代码来源:index.php

示例7: foreach

    foreach ($author as $p) {
        $total = $p->count;
    }
    render('profile', array('exists' => $exists, 'page' => $page, 'posts' => $posts, 'total' => $author['count'], 'author' => $author, 'name' => $name, 'tags' => $tags, 'category' => $category, 'likes' => $likes, 'has_pagination' => has_pagination($page, $total)));
});
get('/cat/:name', function ($name) {
    $page = from($_GET, 'page');
    $page = $page ? (int) $page : 1;
    $categoryposts = get_posts_category($name);
    $tags = get_tags();
    $category = get_category();
    $likes = get_likes();
    foreach ($categoryposts as $p) {
        $total = $p->count;
    }
    render('category', array('page' => $page, 'author' => $categoryposts, 'tags' => $tags, 'category' => $category, 'likes' => $likes, 'has_pagination' => has_pagination($page, $total)));
});
get('/post/:title', function ($title) {
    $post = find_post($title);
    if (!$post) {
        not_found();
    }
    foreach ($post as $ps) {
        $id = $ps['id'];
    }
    $tags = get_tags();
    $comments = get_comments($id);
    $category = get_category();
    $likes = get_likes();
    render('post', array('title' => $post->title . ' ⋅ ' . config('blog.title'), 'p' => $post, 'tags' => $tags, 'comments' => $comments, 'category' => $category, 'likes' => $likes));
});
开发者ID:rth1972,项目名称:bootstrap_blog,代码行数:31,代码来源:index.php


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