⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

GroceryCRUD + Template Engine



josepichu

josepichu
  • profile picture
  • Member

Posted 11 March 2012 - 21:45 PM

Hi!

I'm developing a project using CodeIgniter and a Template Engine (Twig, and parser library). But, when i display my $output i have an error:
I've use the parser library too but i have got the same error:

the code:
...
$output = $this->grocery_crud->render();

$this->parser->parse('view.php' $output);
....

the error:

[b] A PHP Error was encountered[/b]

[color=#555555]Severity: 4096[/color]
[color=#555555][b]Message: Object of class stdClass could not be converted to string[/b][/color]
[color=#555555]Filename: 2d/d3a53a7a1b5fb7e12be4121ed245.php[/color]
[color=#555555]Line Number: 91[/color]

web-johnny

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 11 March 2012 - 23:53 PM

Actually I never used the parser library but this will probably work for you:


$this->parser->parse('view.php',(array)$output);


However my opinion is to NOT use the template parser of codeigniter as it is really weak. You can ONLY have {something} and {/something}, nothing more, so it is not a real template parser as for example smarty .
My suggestion is to use the normal view of codeigniter ($this->load->view) as you can add your own php there or to use a template library like Phil Sturgeon's Template Library .

josepichu

josepichu
  • profile picture
  • Member

Posted 12 March 2012 - 12:34 PM

Hi!

Thanks! it does what you said,

I'm using [b]Twig [/b]Template Engine Library for CI, i hade to use the [b]raw [/b]filter to show the html code in my view, like this: {{ output | raw }}
and its works perfectly, but when i want to edit a some record, my edit doesn't work, ... and jquery UI icons and plugins doesn't work... look at this:

http://i.imgur.com/mBMoB.jpg

when i click update button:

http://i.imgur.com/lwr1K.jpg

i have included the js and css files correctly... it's very strange :S. The problem is something about Twig i think... i suppose is complicated you know the resolve... but i'm used to using a template library.... and i don't know another place to ask it. :(

Thanks!

josepichu

josepichu
  • profile picture
  • Member

Posted 12 March 2012 - 15:30 PM

I have solved it!
I Love GroceryCRUD!