新人求助,为什么是空白页,错哪都看不见(已解决)

#1 okbb

教程里有个smarty的留言板,但是没有show详细的页显示,于是我自己依胡画瓢,加了个show.html
 




213




  


      <{$g.title}><{$g.name}>


  





main.php里面加了个
 
function show(){ // 这里是查看留言内容  
        $id = $this->spArgs("id"); // 用spArgs接收spUrl传过来的ID  
       $guestbook = spClass("guestbook");  // 还是用spClass  
       $condition = array('id'=>$id); // 制造查找条件,这里是使用ID来查找属于ID的那条留言记录  
       $this->$g= $guestbook->find($condition);  // 这次是用find来查找,我们把$condition(条件)放了进去  
  
$this->display("{$tpl}/show.html");
   }  



index.php改成

 
<{foreach from=$results item=one}>
      
  • <{$one.name}><{$one.title}>
    <{$one.contents}>

  • <{/foreach}>


    为什么进到show.php一片空白,啥都没。。。

    2010-08-04 14:56:35

    #2 jake

    怎么改到了index.php来了?index.php是入口文件

    而且访问show方法也应该是 index.php?c=main&a=show

    而不是直接访问show.php吧

    2010-08-04 15:36:00

    #3 okbb

    说错了是index.html,每条要有show的链接,

    http://localhost/index.php?c=main&a=show&id=1

    链接这样的,进去一片空白,

    2010-08-04 16:03:18

    #4 weiii

    是不是忘了新建tmp文件夹了

    2010-08-04 16:09:25

    #5 okbb

    ?楼上啥意思,教程里没说呀,有个tmp文件夹,里面还有东西

    2010-08-04 16:11:47

    #6 jake

    main.php中
    $this->$g
    改回
    $this->g

    2010-08-04 16:14:13

    #7 okbb

    改了,还是不行

    2010-08-04 16:17:14

    #8 okbb

    打包上来了,帮看下www.rar

    用firefox出来个 锘 字

    2010-08-04 16:31:36

    #9 jake

    在show()的第一行加上

    $tpl         = $this->spArgs("tpl", "white"); // 这里接收tpl参数,使得模板变化

    2010-08-04 18:44:28

    #10 okbb

    哈,果然行,谢谢了。

    每个新页都要指定下模版。。。

    2010-08-04 20:30:59