Search code examples
codeigniterhttp-redirectpyrocms

PyroCMS how to call codeigniter helper in template?


I would like to add codeigniter helper to template.

For example:

{{ helper:redirect uri="/order/images/" method="refresh" }}

but it doesn't work. It is possible to call standart helper this way?


Solution

  • I don't know is it right way but it works:

    class Plugin_AvHelper extends Plugin_Helper
    {
        public function redirect()
        {
                $uri        = $this->attribute('uri');
            $method     = $this->attribute('method');
    
            return $uri && $method ? redirect($uri, $method) : NULL;
        }
    }
    

    and to call:

    {{ avhelper:redirect uri="/order/images/" method="refresh" }}