0

我是codeigniter的新手。我喜欢 jFormer,我想知道将 jFormer 与其集成的最佳方式是什么。

您还推荐什么替代 jFormer 的方法?

4

1 回答 1

1

当我看到jFormer 的文档时,您需要与我创建的smarty集成类似:

// File libraries/Smarty_tpl.php
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

//smarty class
require "/usr/share/php/smarty3/libs/Smarty.class.php";


class Smarty_tpl extends Smarty {

function __construct(){
    parent::__construct();

    $smarty_dir = "/usr/share/php/smarty3/libs/";

    $this->setTemplateDir(APPPATH."views/templates");
    $this->setCompileDir(APPPATH."views/templates_c");
    $this->setCacheDir(APPPATH."views/cache");
    $this->setConfigDir(APPPATH."views/config");
    $this->setPluginsDir(array("$smarty_dir/plugins","$smarty_dir/sysplugins/"));
    $this->compile_check=   true;
    $this->force_compile=   true;
    $this->caching=         false;
    $this->cache_lifetime=  86400;
 }
}

它的用法:

$this->load->library("smarty_tpl");
$this->smarty_tpl->display("myform.tpl");

当然不要忘记包含cssjs文件!

于 2012-02-17T10:20:39.267 回答