Exemplo n.º 1
0
function render($tplName, $tplItem)
{
    global $smarty;
    global $smartyConf;
    CSmarty::clearError();
    // 这里,$data有三种数据格式,第一种是我定义的最原始的数据格式,第二种是有的同学在display里面进行了细分,加了extData,第三种是平台的数据格式
    // 所以,在这里先进行一次处理
    // $data = preprocess(CJSON::decode(file_get_contents($tplItem['data'])));
    $data = preprocess(json_decode(file_get_contents($tplItem['data']), TRUE));
    $result = $smarty->do_render($data, $tplName);
    // 有错误发生
    $errors = CSmarty::getError();
    if (count($errors) > 0) {
        return $errors[0];
    }
    return $result;
}