carabiner library with smarty |
[eluser]steven dobbelaere[/eluser]
I'm trying to use the carabiner asset manager in my codigniter cms but I use smarty. I placed the $this->carabiner->display() function in my controller but it echo's rather then return a value. So because I use the function in my controller instead of the view it places the css and javascript code at the beginning of my html output. Assigning it to a smarty variable doens't work because it echo's the output. Inline php code in a smarty template doesn't work either. Any ideas how to solve this?
[eluser]Phil Sturgeon[/eluser]
Set up a helper for the carabiner class then look at my "Access CodeIgniter helpers from Smarty templates" post. Should get it working.
[eluser]mackerel[/eluser]
You may be able to use ob_start() before you call display() and then ob_get_contents() and ob_end_clean() afterwards. I've not personally used output buffering functions in a codeigniter application, but can't imagine it not working for you. Regards
[eluser]steven dobbelaere[/eluser]
[quote author="Phil Sturgeon" date="1250260961"]Set up a helper for the carabiner class then look at my "Access CodeIgniter helpers from Smarty templates" post. Should get it working.[/quote] I'm new to codeigniter and I do'nt quite know how what to place in the carabiner helper. Executing the helper function with smarty works now. Could you please help me
[eluser]steven dobbelaere[/eluser]
[quote author="mackerel" date="1250260985"]You may be able to use ob_start() before you call display() and then ob_get_contents() and ob_end_clean() afterwards. I've not personally used output buffering functions in a codeigniter application, but can't imagine it not working for you. Regards[/quote] I've tried it with the ob_start function but it still executes the display function directly
[eluser]Phil Sturgeon[/eluser]
[quote author="mackerel" date="1250260985"]You may be able to use ob_start() before you call display() and then ob_get_contents() and ob_end_clean() afterwards. I've not personally used output buffering functions in a codeigniter application, but can't imagine it not working for you. Regards[/quote] What the hell does output buffering have to do with displaying CodeIgniter library content in Smarty? Answered the PM. Can we keep this chat in here please? I notice replies and PM's just as quickly.
[eluser]steven dobbelaere[/eluser]
k so I got it to work thanx to Phil Sturgeon I made a helper with the following function carabiner_display(){ $CI =& get_instance(); $CI->load->library('carabiner'); $CI->carabiner->display(); } I called this helper with smarty in the template file like this: {$carabiner|helper:'carabiner':'carabiner_display'} |
Welcome Guest, Not a member yet? Register Sign In |