Welcome Guest, Not a member yet? Register   Sign In
carabiner library with smarty
#1

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

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

[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
#4

[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
#5

[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
#6

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

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




Theme © iAndrew 2016 - Forum software by © MyBB