留言页能不能批量自动替换存在的字段

#1 xoYu

  function show(){
        $tpl = $this->spArgs("tpl", "green");
        $id = $this->spArgs("id");
        $guestbook= spClass("guestbook");
        $conditions = array('id'=>$id);
        $result = $guestbook->find($conditions);
        //echo "

name:{$result['name']}

";
        //echo "

star:{$result['star']}

";
        //echo "

job:{$result['job']}

";

        $this->name = $result['name'];
        $this->display("{$tpl}/show.html");
    }



$this->name = $result['name'];
这一行这样 只能一个一个替换
有没有办法吧存在的字段全部给替换了
就不用一行一行写这么多代码了

2013-01-30 16:06:53

#2 xoYu

@jake 不晓得论坛能不能@到

2013-01-30 16:07:57

#3 jake

$this->result = $guestbook->find($conditions);

模板里面当数组用

2013-01-30 16:58:27

#4 xoYu

jake 发表于 2013-1-30 16:58
$this->result = $guestbook->find($conditions);

模板里面当数组用
给个例子或者地址看看呗 感谢

2013-01-30 18:16:59

#5 jake

提问前请先看手册

2013-01-30 20:55:54

#6 xoYu

jake 发表于 2013-1-30 20:55
提问前请先看手册
手册一直在看啊 看了两天了
基本 上算是入门了
但是有些具体的东西还是不知道啊

2013-01-30 21:02:54

#7 xoYu

<{$result['name']}>

<{$result.name>

这样当数组也出不来 蛋疼啊

2013-01-30 21:16:57

#8 xoYu

终于搞定了
现在的问题就是项目结构的规划了

cool

2013-01-30 21:22:29

#9 tk1942

xoYu 发表于 2013-1-30 21:22
终于搞定了
现在的问题就是项目结构的规划了
请楼主赐教怎么出来的?得到数组的?

2015-12-22 14:26:46

#10 jake

tk1942 发表于 2015-12-22 14:26
请楼主赐教怎么出来的?得到数组的?
稍微看看手册就有了~~~

2015-12-22 16:49:09