I would like to build an app (e-shop) where every block (partial) can be rendered separately (to serve these blocks with pAJAX), but at the same time, i want to get the whole page if it is requested directly. Let me explain it by example.
e-shop catalog page consits of the following blocks (partials):
- products
- news
- footer
- cart
e-shop index page consits of the following blocks (partials):
- article
- news
- footer
- cart
e-shop product page consits of the following blocks (partials):
- product
- news
- footer
- cart
So if i request "/catalog/robots" i get a page with all for blocks rendered, but when i request "/block/cart" i would like to get only the contents on cart partial.
How to design Controllers (and Views) properly, so i do not have to fetch cart products again and again in every ProductsController, ProductController, IndexController (for example)? Can i do something like:
class IndexController extends \Phalcon\Mvc\Controller {
use CartController;
use NewController;
....
}
How can i design everything to work as i plan it to work?