Where should partial templates files be placed in Phalcon? Is there any config for that?
Where should partial templates files be placed in Phalcon? Is there any config for
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Partials
They have to be under the
viewfolder. An example structure is below:If you want your partials to be in a specific subfolder then you will need to define it in the partial argument
The above will look for a file in the
views/partialsfolder by the name ofheader.phtmlorheader.voltor whatever your registered view engine is. (phtml is the default).NOTE You are not restricted to use a folder to add your partials in. They can happily be in the
viewsfolder on their own. You can organize yourviewsfolder the way you see fit.The
layoutsfolder underviewscontains templates that can be used anywhere in the flow of the application but are not partials. Think of them as addons to your current template flow.A layout called
maintemplate would be invoked in the controller layer as such:If you navigate to say
/about/index, Phalcon will pick theviews\index.voltfile, then thelayouts\main.voltand finally theviews\about\index.voltNOTE Again I am using the volt example above – it could easily be phtml or any other View engine you use (phtml is the default).
HTH