本帖最后由 tobem 于 2012-1-4 14:17 编辑
我尝试利用以前看到的一个调用最新100个帖子(分页)的代码,改了一下,想做成门户文章的sitemap,但是貌似不行……
现在打开的页面是这样的:http://www.mamapai.com/juhe.php,用的是DIY调用100个最新文章,没什么特别的,不是通过下面的查询代码来的,只是先凑乎用一下,还是希望高手能够帮忙将这段代码完善一下,谢谢!
代码如下,是不是哪个地方写错了,麻烦高手帮忙改一下,不胜感激!
- <?php define('APPTYPEID', 4);define('CURSCRIPT', 'sitemap');require './source/class/class_core.php';$discuz = & discuz_core::instance();$discuz->cachelist = $cachelist;$discuz->init();$navtitle='怀孕内容聚合';$metakeywords='';$metadescription=' ';include template('common/header');echo '<style type="text/css">.newtid{width:100%;float:left}.newtid li{padding-left:2%;font-size: 14px;width:48%;float:left;line-height: 25px;}.newtid li a{color: #036;}.newtit strong a{position: absolute;bottom: 98765px;}.newtid h2{font-size: 16px;line-height: 45px;}</style><ul class="newtid">';
- $site_num = DB::result(DB::query("SELECT COUNT(`aid`) FROM ".DB::table('portal_article_title')." as a inner join ".DB::table('portal_category')." as b on a.catid=b.upid where a.status=0 ORDER BY a.aid DESC"));
- $site_num = $site_num ? $site_num :0;
- $site_listnum = 100;
- $site_page = intval($_G['gp_page']) ? intval($_G['gp_page']) :1;
- $site_max = $site_page > 0 ? $site_listnum * ($site_page-1) : 0;
- $site_max2 = $site_max2 + 100;
- $querys = DB::query("SELECT a.aid,a.title,a.catid,b.upid FROM ".DB::table('portal_article_title')." as a inner join ".DB::table('portal_category')." as b on a.catid=b.upid where a.status=0 ORDER BY a.aid DESC LIMIT ".$site_max.",".$site_max2);
- $multipage = multi($site_num, $site_listnum,$site_page, "juhe.php");
- $i=1;while($threadfid = DB::fetch($querys)){echo '<li>'.$i.'、<em>[<a href="portal.php?mod=list&catid='.$articleaid['aid'].'">'.$articleaid['name'].'</a>]</em> <a href="portal.php?mod=view&aid=&page='.$articleaid['aid'].'" target="_blank">'.$articleaid['title'].'</a></li>';$i++;}echo '</ul>';
- echo $multipage;
- include template('common/footer');?>
复制代码
是调用的表格有问题,还是调用字表段的问题?
|