【求助】
发布于:2022-01-17 09:50:54
#1 rockman
我在控制器中这么写的:
$courselistObj = spClass("m_courselist");
$abc = $this->result = $courselistObj->findBy("id",$this->spArgs("id"));
//if(strstr('1',$abc['version']) && strstr('2',$abc['version'])){dump '1111';die;}//这一行没注释的话是会执行的。
然后模版中是这样的:
课程适用版本<{$result.version}> | <{if strstr('1',$result.version)}>Web版 | <{/if}><{if strstr('2',$result.version)}>Android平板电脑版 | <{/if}><{if strstr('3',$result.version)}>Android手机版 | <{/if}><{if strstr('4',$result.version)}>iOS iPhone版 | <{/if}><{if strstr('5',$result.version)}>iOS iPad版<{/if}> | 运行的结果是:
课程适用版本1,2,3
但是那个什么“Web版 | Android平板电脑版 | ”没有如期显示出来。。。
不知道为什么啊?
2012-04-27 11:25:16
#2 jake
建议你按我们的教程或者文章里面指导的方式来写程序。比如说
$abc = $this->result = $courselistObj->findBy("id",$this->spArgs("id"));
这种方式很少会有人使用,我们教程里面也没有。最好是
$this->result = $courselistObj->findBy("id",$this->spArgs("id"));
还有,smarty里面的语法,建议可以看看教程,类似strstr这种函数是不能在模板里面执行的。
PS:建议真的自己去好好学习或者研究一下再提出问题,这样乱写程序然后提问非常不好。
2012-04-27 11:48:42
#3 rockman
jake 发表于 2012-4-27 11:48
建议你按我们的教程或者文章里面指导的方式来写程序。比如说
$abc = $this->result = $courselistObj->fin ...
$abc = $this->result = $courselistObj->findBy("id",$this->spArgs("id"));
这个是我不知道怎么取$this->result中某一项的值所以才这么赋值去取的。请教我一下吧!
是我不了解smarty模版还有这么多限制的,所以才写出来很多这种程序。{:soso_e110:}
2012-04-27 12:44:44
#4 jake
rockman 发表于 2012-4-27 12:44
$abc = $this->result = $courselistObj->findBy("id",$this->spArgs("id"));
这个是我不知道怎么取$this ...
不知道,或者不了解,最好先去学学。speedphp的教程算是最容易学习的了。
2012-04-27 13:16:23