WordPress Chinese Forums's Archiver

silverlight 发表于 2008-9-18 22:07

page-nav无法显示分页的问题

再用 pagenav进行分页时 在首页的文章列表中可以正常工作 但是在显示<ul><li></li></ul>的文章列表时 无论点第几页显示的都是第一页的文章 那位高手帮忙看一下,代码如下

<?php get_header(); ?>
<div id="content-box">
  <div id="contentarea">
  <?php if (have_posts()) : ?>
  <?php query_posts('cat=3&showposts=10'); ?>
    <div class="post"><div class="content">
    <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
          </div></div>         
  <ul>
                <?php while (have_posts()) : the_post(); ?>
                 
                        <div class="post" id="post-<?php the_ID(); ?>">
                                <li><?php if (function_exists('get_cat_icon')) get_cat_icon('fit_width=20&fit_height=20'); ?><a href="<?php the_permalink() ?>" rel="bookmark" title="ermanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
                                <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
                                
                <?php endwhile; ?>
                </ul>
                <div class="navigation"><?php if(function_exists('wp_pagenavi')){ wp_pagenavi(); } else { ?>
   <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div>
   <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div>
   <?php } ?>
  </div>
        <?php else : ?>
                <h2 class="center">Not Found</h2>
                <p class="center">Sorry, but you are looking for something that isn't here.</p>
                <?php include (TEMPLATEPATH . "/searchform.php"); ?>
        <?php endif; ?>
        </div>

carlale 发表于 2008-9-19 00:21

Blog地址?

silverlight 发表于 2008-9-19 19:27

我的博客还没有放到公网,还在内网调试。
问题可能上面说的不清楚,就是我在一个page中想做一个如下效果的post列表,使用了pagenav插件
<ul>
<li>文章1标题</li>
<li>文章2标题</li>
。。。。。
<li>文章10标题</li>
</ul>
10篇文章以上时就产生了下一页 ,但是点击后面的页码时 显示的内容却总是第1页的。
上面的代码就是我做的该页面的模板

silverlight 发表于 2008-9-20 21:32

自己顶一个

silverlight 发表于 2008-9-26 10:49

最近刚刚配好地址 [url]http://meco.cuc.edu.cn/[/url] 在各个page中显示相应的分类文章时 <?php query_posts('cat=1&showposts=10'); ?>但是难以实现分页功能 有没有见过呢?

hedy 发表于 2008-9-26 11:04

是不是因为只获取了10篇文章,没办法分页的原因,如果把showposts=10去掉是什么样子呢

silverlight 发表于 2008-9-26 12:50

我试过了 去掉后在同一页会把所有的文章都列出来 pagenav根本不管用 但在index和归档中pagenav是好用的

页: [1]

Powered by Discuz! Archiver 7.0.0  © 2001-2009 Comsenz Inc.