phpcms ajax 更新文章显示列表

阅读更多

要先建立一个html模板,

     /phpcms/templates/default/content/home_ajax_list.html

    

 

 


{pc:content action="lists" catid="10" order="id DESC" thumb="" moreinfo="1" } {loop $data $n $r}
  • {$r['title']}
  • {/loop} {/pc}
    {$pages}

     

     

          在你的包含列表页面

          比如在你的  /phpcms/templates/default/content/index.html中添加下面代码

         

    {template "content","home_ajax_list"}

     

     

     

     

        php代码

     

        在  /phpcms/modules/content/index.php中加,就是复制init(),增加page获取,改变template,就可以了

     

         

    public function homeajaxlist() {
    		if(isset($_GET['siteid'])) {
    			$siteid = intval($_GET['siteid']);
    		} else {
    			$siteid = 1;
    		}
            $page = $_GET['page']?$_GET['page']:1;
    		$siteid = $GLOBALS['siteid'] = max($siteid,1);
    		define('SITEID', $siteid);
    		$_userid = $this->_userid;
    		$_username = $this->_username;
    		$_groupid = $this->_groupid;
    		//SEO
    		$SEO = seo($siteid);
    		$sitelist  = getcache('sitelist','commons');
    		$default_style = $sitelist[$siteid]['default_style'];
    		$CATEGORYS = getcache('category_content_'.$siteid,'commons');
    		include template('content','home_list_ajax',$default_style);
    	}
    

     

     

     

     

     

     

          

    你可能感兴趣的:(phpcms,ajax,pages,jquery)