Closed waptik closed 7 years ago
You don't have to add base_url
, because this library does it.
See https://github.com/kenjis/codeigniter-ss-twig#supported-codeigniter-helpers.
Okay thanks, I got it working.
Also I have this issue . I added the widget() method your library as follow:
// libraries / Twig.php
.....
public function widget($name){
$this->_widget = '_includes.'$name.'.html';
return $this;
}
// in my controller/home.php
.....
public function index(){
$this->twig->addGlobal->('twig', $this->twig);
......
$this->twig->display('home');
}
// views home.php
{# let's include the header page #}
{% include twig.widget.header %}
{# end #}
............#
This is the error I get A PHP Error was encountered Severity: Warning Message: Missing argument 1 for Twig::widget(), called in .......
Do you want like this?
public function widget($name){
return $this->_widget = '_includes.'$name.'.html';
}
{% include twig.widget(header) %}
Yes that's what I was working on. Do you know any idea how to achieve it? UPDATE 1 : I tried your solution but I got this error : An Error Was Encountered
Unable to find template "_includes/0.html" (looked into: /home/waptik/public_html/../..app/views/twig).
I don't know why it's 0.html and not header.html
UPDATE 2: I got it working with this {% include twig.widget('header') %} Thanks for the hand.
Hi i am using this library but facing a problem while trying to use functions. Question on SO is not mine but i am facing same problem. i have already loaded url and form helpers in my controller. I hope someone can help.
my error
http://stackoverflow.com/questions/41662788/unable-to-add-codeigniter-function-at-twig (reffered from SO)