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.


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:

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/ <ul> <li>controllers/ &lt;ul&gt; &lt;li&gt;IndexController.php // logic for index page&lt;/li&gt; &lt;li&gt;AboutController.php // logic for about page&lt;/li&gt; &lt;/ul&gt;</li> <li>views/ &lt;ul&gt; &lt;li&gt;index.volt // &amp;quot;outer&amp;quot; template with header, footer, and css.js includes (all pages load this)&lt;/li&gt; &lt;li&gt;index/ &amp;lt;ul&amp;gt; &amp;lt;li&amp;gt;index.volt // &amp;amp;quot;inner&amp;amp;quot; template for index page&amp;lt;/li&amp;gt; &amp;lt;/ul&amp;gt;&lt;/li&gt; &lt;li&gt;about/ &amp;lt;ul&amp;gt; &amp;lt;li&amp;gt;index.volt // &amp;amp;quot;inner&amp;amp;quot; template for about page&amp;lt;/li&amp;gt; &amp;lt;/ul&amp;gt;&lt;/li&gt; &lt;/ul&gt;</li> </ul>

Hope this helps!