class Controller_Post extends Controller_Template { public function action_index() { $this->template->content = View::factory('posts/index.smarty', array( 'posts'=>Model_Post::find('all'), // doesn't work! //'posts'=>array_values(Model_Post::find('all')), // works ok. )); } } // Smarty code: {section name=i loop=$posts} {$posts[i]->title} {/section}
I tried setting left and right delimiters (I prefer '{{' and '}}' so it doesn't interfere with JavaScript functions). This is my app/config/parser.php:Davide Bellini wrote on Thursday 8th of September 2011:Which configurations have you tried?
return array( 'extensions' => array( 'php' => 'View', // 'smarty' => 'View_Smarty', // we want .tpl, not .smarty 'tpl' => array('class' => 'View_Smarty', 'extension' => 'tpl'), ), 'View_Smarty' => array( 'include' => APPPATH.'vendor'.DS.'Smarty'.DS.'libs'.DS.'Smarty.class.php', 'delimiters' => array('{{', '}}'), 'environment' => array( 'compile_dir' => APPPATH.'tmp'.DS.'Smarty'.DS.'templates_c'.DS, 'config_dir' => APPPATH.'tmp'.DS.'Smarty'.DS.'configs'.DS, 'cache_dir' => APPPATH.'cache'.DS.'Smarty'.DS, 'caching' => false, 'cache_lifetime' => 0, 'force_compile' => true, // debug! 'compile_check' => true, 'debugging' => false, 'autoload_filters' => array(), 'default_modifiers' => array(), ), ), );
// packages/parser/config/parser.php: 'delimiters' => array('{%', '%}'), // app/config/parser.php 'delimiters' => array('{{', '}}'), // controller: var_dump(Config::get('parser.View_Smarty.delimiters')); // output: array(4) { [0]=> string(2) "{%" [1]=> string(2) "%}" [2]=> string(2) "{{" [3]=> string(2) "}}" }
// config/parser.php: 'delimiters' => array( 'left' => '{', 'right' => '}' ),
$view->test = Model_Test::find('all'); // Orm $view->test1 = \DB::select()->from('test')->execute(); // Fuel DB Class
// Fuel Db Class $view->test1 = \DB::select()->from('test')->execute()->as_array();
I had 1.0.1 at first and used scaffolding to create form "posts". I added a few records with titles "test<b>123</b>" for instance. Output filtering worked and it was displayed with < (correct).
Then I upgraded to latest dev version and copied app/ over. However, now the titles display partially bold even though output filtering should be used!
(Note: I am not using Smarty templates here, just normal views)
// inside 'security': 'output_filter' => array('htmlentities'),
Andrew Black wrote on Thursday 8th of September 2011:Found the bug:// packages/parser/config/parser.php: 'delimiters' => array('{%', '%}'), // app/config/parser.php 'delimiters' => array('{{', '}}'), // controller: var_dump(Config::get('parser.View_Smarty.delimiters')); // output: array(4) { [0]=> string(2) "{%" [1]=> string(2) "%}" [2]=> string(2) "{{" [3]=> string(2) "}}" }
It merges the array instead of replacing the values! I guess this is a bug, but is it Config or Parser bug? A different config style would solve this issue:// config/parser.php: 'delimiters' => array( 'left' => '{', 'right' => '}' ),
It looks like you're new here. If you want to get involved, click one of these buttons!