I would like to add some PHP to my Codeigniter view, for, say, a dynamic date in the footer. What is the very best way to manage this?
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.
There’s nothing wrong with having PHP in your views. I use PHP in my views all the time for things like looping through arrays and creating ordered lists, etc. IMO, MVC is not about separating HTML from PHP, it’s about separating business logic and display logic.
There are many different interpretations and implementations of MVC, so some people will disagree with me, and that’s fine. Decide how you want to use MVC and be consistent throughout your project.