kenjis / codeigniter-ss-twig

A Simple and Secure Twig integration for CodeIgniter 3.x and 4.x
MIT License
168 stars 46 forks source link

Support constant #5

Closed provalinf closed 9 years ago

provalinf commented 9 years ago

Hi Kenjis, Thank you for your very good plugin, after having tested many, it is the only one that meets my needs and works perfectly. But how can I add the addconstant (addGlobal()) support, if I write in my controller : $this->twig->addGlobal ('', '') , method is not defined.

I tried to add this in your extension :

    public function addGlobal($name, $value)
    {
        $this->createTwig();
        return $this->twig->addGlobal($name, $value);
    }

without success (I think the problem is that the object is redefined as "render" is called, but you know that better than me ^^)

Could you add this feature? Thank you and sorry again for my translation

kenjis commented 9 years ago

Do you use the leatest Twig.php?

I think the problem is that the object is redefined as "render" is called

I fixed the problem some days ago.

provalinf commented 9 years ago

I edit a message telling you that it worked, and that this was therefore a feature proposal to add, but you edit afterwards ^^. It is functional for me, I just made a mistake.

kenjis commented 9 years ago

Okay, I will consider. Thank you for your proposal.

kenjis commented 9 years ago

I added: https://github.com/kenjis/codeigniter-ss-twig/blob/master/libraries/Twig.php#L99

provalinf commented 9 years ago

Superb, thank you for your rapidity.