include header and footer file separately in project

i want to include header.php and footer.php in whole project in and all css and javascript how could i do it conveniently in phalcon please explain with example

Do you mean in your View or in every Controller? A little more detail would be helpful.

in view part only

Volt has the {{ partial }} tag. Also, you can include raw PHP in Volt templates.



1.4k

It sounds like you're just jumping in to Phalcon and MVC from a more classic style of setting up sites. Take your time and really leverage the documentation.

I think if you hit the docs, and prepare to shift your mindset on how to assemble sites, you should pick up the "Phalcon way" pretty quickly.

Check out: http://docs.phalconphp.com/en/latest/reference/views.html

You can set up your main "outer" template in app/views/index.volt, and then the individual page "inner" templates go into files like app/views/index/index.volt and app/views/about/index.volt and so on. Any data preparation or logic will go into the controller files in app/controllers/IndexController.php and app/controllers/AboutController.php and so on. The routing will take care of putting it all together.

  • app/
    • controllers/
      • IndexController.php // logic for index page
      • AboutController.php // logic for about page
    • views/
      • index.volt // "outer" template with header, footer, and css.js includes (all pages load this)
      • index/
        • index.volt // "inner" template for index page
      • about/
        • index.volt // "inner" template for about page

Hope this helps!