|
本帖最后由 haoshaoyee 于 2012-9-13 15:08 编辑
用了smarty模板 在扩展的smarty类里一部分是这样写的
require_once( APPPATH.'third_party/smarty/libs/Smarty.class.php' );
class CI_Smarty extends Smarty
{
var $CI;
function __construct()
{
parent::__construct();
$this->CI =& get_instance();
$this->CI->load->helper('url');
$this->registerPlugin('function','site_url ','site_url');
$this->registerPlugin('function','base_url ','base_url');
............................
配置文件里是这样的
$config['base_url'] = 'http://xx.com';
$config['index_page'] = 'index.php';
然后模板调用
{site_url a=x b=y c=z} //效果为 http://xx.com/index.php/x/y/z.html
{base_url a=x b=y c=z} //效果为 http://xx.com/x/y/z
求解 这里是怎么出来的 看了下Config类的这两函数 貌似没有extract之类的呀,做了个exit
感觉这到挺方便的 但是不敢用 不明其理
真是笨啊 手册上明明写了
这是一个以数组形式传递 URI 段的例子: $segments = array('news', 'local', '123');
echo site_url($segments);可以用数组的嘛
|
|