How would I include a page from the public folder in one of my views? I want to include a single header like I do in PHP so when I make a change it affects all the other pages. (It is for multiple views)
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.
For the most part, the only web pages in the public folder will be purely static (custom 404 pages, FAQ, etc). If you have a piece of static HTML that you’d like to be displayed in a lot of pages, a partial is what you’re looking for.
A partial doesn’t have to be tied to a controller. You can create the sub-directory:
and fill it with a whole bunch of partials, so you would have:
and anywhere you want those fragments, you can do:
and voila, you’re done!