View in PHP MVC project

Asked

Viewed 341 times

0

I’m developing a PHP MVC project and I did the whole view in.html files. When I need to manipulate a form, I specify in the action the path to a script in the controller. My question is whether it is necessary to view only in . html files without any php. Also, I need to implement a login system so that I have to implement some form of php login control on the html pages.How would I proceed?

1 answer

0


To view is where you will put the output of your application, but often it becomes necessary to do some encoding, so you can create views with extension. php.

Illustrating: Assuming you have to list registered users of a system, you can only do this if you have views with extension . php or . phtml;

This is necessary because, you need to run php code in this view.

Login: Regarding login, you can manage sessions through Controllers and output in Views.

  • Wrong. Multiple frameworks support views in html for making use of template engine.

  • 1

    I fully agree with @Gustavo Carvalho, the view idea is not to use business logic, no matter what code you will use in the view, the important thing is not to mix the business logic with the view.

  • @Papa Charlie, I’m not saying you can’t have views . html, I’m telling you that if necessary you can have views . php ( for listings, etc );

  • This project can help http://dwoo.org/, use it always, views are in . tpl format

Browser other questions tagged

You are not signed in. Login or sign up in order to post.