We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Using Phalcon MVC, how to pass parameters in volt files using Macros function

Seriously I am bugged for two weeks, I dont know using macros function How to pass parameters. if i have a business logic

class Test extends Phalcon\Mvc\Model
{
   public function Atest($url) { return $this->$Url ; }
}

in Controller,

  public function indexAction()     {   
    $test = new Test();   $this->view->test= $test; 
    $this->view->setVar("Atest", function($Atest){ return  $Atest; }); 
  }

in Volt file, I have to display a values using macro function, Is it Possible?

{%- macro Atest(url) %}    {% return... %}  {%- endmacro %}

whether i can pass paameters to return values from business logic

Please help...

edited Mar '14

Hi @Hariees RaviKumar

try something like:

{%- macro my_input(atest) %}
    {% return(atest.url) %}
{%- endmacro %}
{{ '<p>' ~ my_input(atest) ~ '</p>' }}