Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Split MVC - View into class containing logic and raw template
  • I am convinced that templates should not contain any logic just { } and include and block parts thats all. Flow s hould be: request -> controller (do logic load model...) -> view (logic connected to view in php with loaded raw template) -> output How to implement in fuelphp this idea with templating engine such as twig or any other? How to access raw template engine object in view class? parser() just maps some of the object methods behind it but not all. Thanks
  • I tend to agree with that. This is why FuelPHP has the Viewmodel (which implements the Presenter pattern), which is exactly designed to contain the pre-processing logic for the view. If you have the Parser package active, the Viewmodel will use it to load the templates instead of the standard View class. So "Viewmodel::forge("my/template.tpl") works just like with View::forge().

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion