04月 24th, 2008的文章列表
ECShop调用具体的自定义商品属性
6条留言ECSHop的自定义属性很是好用,但是在前台输出的时候非常麻烦,只能循环输出所有的附加商品属性,不能输出制定的某个自定义的属性,本来它用的是Smarty模板,但是到2.5之后好像是把Smarty修改很多,里面好多东西不能用了。今天给朋友改东西,随便就写了下。
我只在商品具体信息页面(goods.php)做了这个事情,可以的话可以写到每个页面去。
Smarty技巧
暂时没有留言安装:
可以通过继承来实现安装的,看代码
PHP代码
- //setup.php
- <?php
- require("libs/Smarty.class.php");
- class Smarty_C extends Smarty{
- function Smarty_C(){
- $this->smarty();
- $this->template_dir = 'templates';
- $this->compile_dir = 'templates_c';
- $this->cache_dir = 'cache';
- $this->left_delimiter = '<{';
- $this->right_delimiter = '}>';
- $this->caching = 1;
- $this->cache_lifetime = 1800;
- $this->config_dir = 'config';
- //regist functions
- $this->register_block('dynamic','smarty_block_dynamic',false);
- }
- }
- function smarty_block_dynamic($param, $content, $smarty) {
- return $content;
- }