CodeIgniter Forums
carabiner library with smarty - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: carabiner library with smarty (/thread-21579.html)



carabiner library with smarty - El Forum - 08-14-2009

[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?


carabiner library with smarty - El Forum - 08-14-2009

[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.


carabiner library with smarty - El Forum - 08-14-2009

[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


carabiner library with smarty - El Forum - 08-14-2009

[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


carabiner library with smarty - El Forum - 08-14-2009

[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


carabiner library with smarty - El Forum - 08-14-2009

[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.


carabiner library with smarty - El Forum - 08-14-2009

[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'}