news//pageheader.tpl 对应 news/$catalog/pageheader.tpl
所以应该看看$catalog的输出,你现在$catalog是空值,应该是非空才对!

解决方案 »

  1.   

    $catalog值应从这来的:
    帮我看一下,楼上兄弟
    <?php
    require_once('../base.php');
    if($_REQUEST[catalog]=="0103"){
    $GLOBALS['rows']=5;
    }
    ?><?
    //&Aacute;&ETH;±í&Iuml;&Ocirc;&Ecirc;&frac34;&Auml;&Uacute;&Egrave;&Yacute;
    function listAll(){
    global $db , $func ,$smarty ;

    $selectSql = "select * from $GLOBALS[news_table]  where news_type = '$_REQUEST[catalog]'   ";

    $selectSql .=" order by news_seq desc  ";


    mylog(__LINE__,"selectSql=$selectSql");
    $db->SetFetchMode(ADODB_FETCH_ASSOC);
    //$rs = $db->Execute($selectSql);
    $page = $_REQUEST['page'] ? $_REQUEST['page'] : 1;
    $nrows = $GLOBALS['rows'];
    $rs = $db->PageExecute($selectSql, $nrows, $page);
    if($db->ErrorMsg()){
    mylog(__LINE__,"Db Error" . $db->ErrorMsg() );
    }else{
    $rs_arr = $rs->GetArray();
    $smarty->assign('rs_arr',$rs_arr );
                                    if($rs->AtFirstPage()){
                                            $prevpage = 1 ;
                                    }else{
                                            $prevpage = $page -1 ;
                                    }
                                    if($rs->AtLastPage()){
                                            $nextpage = $page ;
                                    }else{
                                            $nextpage = $page +1 ;
                                    }

                                    $smarty->assign("prevpage", $prevpage);
                                    $smarty->assign("nextpage", $nextpage);
    $smarty->assign("catalog", $GLOBALS[catalog]);
    $smarty->assign("func", $func);
    }
    }#&Iuml;ê&Iuml;&cedil;&Auml;&Uacute;&Egrave;&Yacute;
    function Detail(){
    global $db , $func ,$smarty; $selectSql = "select * from $GLOBALS[news_table]  where news_id = " . $db->Quote($_REQUEST[newsid]) ."  ";
    mylog(__LINE__,"selectSql=$selectSql");
    $db->SetFetchMode(ADODB_FETCH_ASSOC);
    $rs = $db->Execute($selectSql);
    if($db->ErrorMsg()){
    mylog(__LINE__,"Db Error" . $db->ErrorMsg() );
    }else{
    $row = $rs->FetchRow();
    $smarty->assign('row',$row );
    $smarty->assign("func", $func);
    $smarty->assign("catalog", $GLOBALS[catalog]);
    }
    }//&Aacute;&ETH;±í&Iuml;&Ocirc;&Ecirc;&frac34;&Auml;&Uacute;&Egrave;&Yacute;
    function listSearch(){
    global $db , $func ,$smarty, $query_var, $keywords;

    $selectSql = "select * from $GLOBALS[news_table]  where news_type = '$_REQUEST[catalog]' ";
    if($query_var=="0"){
    $selectSql.=" and news_title like '%$keywords%' ";
    }else{
    $selectSql.=" and news_content like '%$keywords%' ";
    }
    $selectSql.=" order by news_id desc   ";
    //echo $selectSql;
    mylog(__LINE__,"selectSql=$selectSql");
    $db->SetFetchMode(ADODB_FETCH_ASSOC);
    //$rs = $db->Execute($selectSql);
    $page = $_REQUEST['page'] ? $_REQUEST['page'] : 1;
    $nrows = $GLOBALS['rows'];
    $rs = $db->PageExecute($selectSql, $nrows, $page);
    if($db->ErrorMsg()){
    mylog(__LINE__,"Db Error" . $db->ErrorMsg() );
    }else{
    $rs_arr = $rs->GetArray();
    $smarty->assign('rs_arr',$rs_arr );
                                    if($rs->AtFirstPage()){
                                            $prevpage = 1 ;
                                    }else{
                                            $prevpage = $page -1 ;
                                    }
                                    if($rs->AtLastPage()){
                                            $nextpage = $page ;
                                    }else{
                                            $nextpage = $page +1 ;
                                    }

                                    $smarty->assign("prevpage", $prevpage);
                                    $smarty->assign("nextpage", $nextpage);
    $smarty->assign("catalog", $GLOBALS[catalog]);
    $smarty->assign("func", $func);
    }
    }#&Iuml;&Ocirc;&Ecirc;&frac34;&micro;±&Ccedil;°&Icirc;&raquo;&Ouml;&Atilde;
    function location(){
    global $db , $func ,$smarty, $catalog, $keywords; $selectSql = "select * from $GLOBALS[catalog_table]  where cat_code = '" . substr($_REQUEST[catalog],0,2) ."'  ";

    $rs = $db->Execute($selectSql);
    if($db->ErrorMsg()){
    mylog(__LINE__,"Db Error" . $db->ErrorMsg() );
    }else{
    $row = $rs->FetchRow();
    $smarty->assign('location1',$row[cat_name] );
    } $selectSql = "select * from $GLOBALS[catalog_table]  where cat_code = " . $db->Quote(substr($_REQUEST[catalog],0,4)) ."  ";
    $rs = $db->Execute($selectSql);
    if($db->ErrorMsg()){
    mylog(__LINE__,"Db Error" . $db->ErrorMsg() );
    }else{
    $row = $rs->FetchRow();
    $smarty->assign('location2',$row[cat_name] );
    }
    $smarty->assign('catalog',$catalog );
    $smarty->assign('keywords',$keywords );}
    location(); if($func=="listAll"){
    listAll();
    }else if($func=="detail"){
    Detail();
    }else if($func=="search"){
    listSearch();
    } $smarty->display('index.tpl');?>
    下面是index.tpl调用的语句
    {include file="news/$catalog/pageheader.tpl"}
      

  2.   

    看一条新闻的内容,如index.php?func=detail&catalog=0101&newsid=410
    应该是赋值了呀?程序也没错呀
      

  3.   

    修改这几行
    <?php
    require_once('../base.php');
    if($_REQUEST[catalog]=="0103"){
    $GLOBALS['rows']=5;
    }
    ?>修改后
    <?php
    require_once('../base.php');
    global $catalog;
    $catalog = $_GET['catalog'];
    if($catalog == "0103")
    {
    $GLOBALS['rows']=5;
    }
    ?>
      

  4.   

    index.tpl中调用detail.tpl。
    detail.tpl中有句显示内容的:
    {$row.news_content}
      

  5.   

    php.ini中的register_globals = off 改为register_globals = on
      

  6.   

    linux下是正确的,所以在winodws下的php的版本和php.ini最好都跟linux下一致。
    根本原因是程序的兼容问题。
    $_REQUEST是无法区分get和post方式。
      

  7.   

    不行,一样
    好像是整个detail.tpl都不启作用,标题、内容等都没显示
    会不会跟$row = $rs->FetchRow();
            $smarty->assign('row',$row );
    其中的fetchrow()函数有关?