[已解决]spHtml的地址既有类别typeid又有page怎么生成?

#1 小双

地址是:http://localhost/index.php?c=test&a=index&typeid=10&page=1
如何生成html静态分页?

下面是分别生成栏目静态页和分页page静态分页的代码:
 
//地址:http://localhost/index.php?c=test&a=index&typeid=10
$urls = array();  
        if( $result = spClass("lib_type")->findAll(array('typeid'=>3))){
            foreach($result as $value){ // 循环
                $urls[] =  array(
                    array('test','index',array('typeid'=>$value['id']))  // 这里和spUrl的参数是相同的
                );
            }
        }
        spClass('spHtml')->makeAll($urls); // 使用makeAll来制作
//****************************************************
//地址: http://localhost/index.php?c=test&a=index&page=1
  $urls = array();
                $o = spClass("lib_cms");
                $total = $o->findCount();
                $perpage = 5;
                $pagenum = ceil($total/$perpage);
                for($i = 1;$i <= $pagenum;$i++){
                        $urls[] = array(
                                array('test','index',array('page'=>$i))
                        );
                }
             spClass("spHtml")->makeAll($urls);

上面代码是分开地址的情况生成html的,而现在的地址是他们的集合,比如:
地址是:http://localhost/index.php?c=test&a=index&typeid=10&page=1
要怎么整合上面的代码还是写其他的代码?

2010-05-25 11:36:29

#2 小双

自己解决了:D

$urls = array();  
        if( $result = spClass("lib_type")->findAll(array('typeid'=>2))){
            foreach($result as $value){ // 循环
                                $o = spClass("lib_cms");
                $total = $o->findCount(array('typeid'=>$value['id']));
                $perpage = 5;
                $pagenum = ceil($total/$perpage);
                for($i = 1;$i <= $pagenum;$i++){
                $urls[] =  array(
                    array('news','index',array('typeid'=>$value['id'],'page'=>$i))  // 这里和spUrl的参数是相同的
                );
                                }
            }
        }
        spClass('spHtml')->makeAll($urls); // 使用makeAll来制作
            echo "新闻中心二级栏目页生成完毕!
";
最后还是要谢谢,jake!!非常感谢,我保证以后老老实实的发帖!

2010-05-25 12:32:23

#3 jake

最近写教程比较忙,见谅见谅:handshake

2010-05-25 16:13:27