Create php MVC application. Cabinet main page

Главная » Tutorials » PHP+MySQL » Create php MVC application. Cabinet main page

Today our task is cabinet main page making. This page requires large html coding. That’s why I will use ready-to-use html template because I want to draw your attention to the more important tasks for you. You can download template by this link.

After page template creating we need to create CabinetController and CabinetModel. In controller as always we define private property – template for rendering and create default method (index), which will render the page with some dynamic data. This data is stored in $pageData array. First of all we will print some basic common statistics – count of orders, products and users. For this purpose we write appropriate methods – getOrdersCount(), getOrdersProductsCount() and getUsersCount(). PHP code of these methods is identical except for table names from which we get the data. Methods return count of rows not specific data. That’s why in sql query we must use COUNT(*) SQL function. And we will get result with fetchColumn() method.

Подписаться на рассылку

Будьте в курсе - получайте последние статьи на свой email

Ваша подписка успешно оформлена

Pin It on Pinterest

Share This