1.

How to inject services into a Volt Template in Phalcon?

Answer»

There are 2 ways to inject services into Volt -

  • Define the function in the dependency injection CONTAINER. Access the service in the TEMPLATE with its name. Example - <input name="‘counter’" VALUE="‘{{maxproduct.getCounter()" }}>
  • When Volt is USED as a stand-alone component, create a COMPILER as $compiler = new VoltCompiler(); and compile the template by passing different return parameters.


Discussion

No Comment Found