0
看來,庫安裝正確,因爲我可以用title()
,set_partial()
和set_layout
設置標題。而且一切正常。但我無法傳遞任何數據。將數據傳遞到視圖安裝<a href="https://github.com/philsturgeon/codeigniter-template" rel="nofollow">Phil Sturgeon Codeigniter Template library</a></p> <p>菲爾鱘魚笨模板庫
如果我在控制器設定新的冠軍$this->template->title('My Title');
我可以輕鬆地獲得冠軍,任何視圖與echo $template['title']
例如,我想傳遞一個信息:
在View:
<?php echo $template['message']; ?>
In Controller I試試:
$this->template->set('message', 'My new mess');
$this->template->build('dashboard');
// I get *Undefined index: message* from View
$data['message'] = ['My new mess'];
$this->template->build('dashboard', $data);
// Same *Undefined index: message*
$this->template->build('dashboard', array('message' => 'My new mess'));
// Even this does not work
使用CI 3. 模板關於解析器配置設置:
$config['parser_enabled'] = FALSE;
$config['parser_body_enabled'] = FALSE;
看來我錯過一個小細節。
要知道,5歲的代碼,並仔細檢查它的所有方法。 – Tpojka
到目前爲止沒有CI 3.0.6的問題。其實我很驚訝,可能最流行的模板庫在4年內沒有任何更新。儘管我沒有使用CI解析器進行嘗試。 – ProgZi