Environment
A navigation bar is designed as follows
NavBar below is the body content.
Demand
A very simple design idea is: Click on the button above (such as about/blog, etc.), main container will 从后台
load the front page.
Original design Ideas
Using the CodeIgniter framework, you intend to bind all the buttons in the navigation bar at the front end Ajax
, each of which triggers an AJAX request. The backend specifically writes a public function to handle the front-end AJAX requests, using $this->load->view('xxx')
the completion of the main The container page is overloaded and implements PHP modularity (header.js/footer.js. etc).
Problem
Because each load of the container is different, the static files used such as css|javascript|img
loading in various container, so that the header and footer template can not be unified. If you write all the static resources in the template PHP, it will inevitably lead to the page 加载时间过长
.
Once thought of alternatives, each container add nav this tag, so that they can be loaded with different static resources, but after the molding of code maintenance is cumbersome, and code duplication is not efficient.
So want to ask if there is any better solution??
Reply content:
Environment
A navigation bar is designed as follows
NavBar below is the body content.
Demand
A very simple design idea is: Click on the button above (such as about/blog, etc.), main container will 从后台
load the front page.
Original design Ideas
Using the CodeIgniter framework, you intend to bind all the buttons in the navigation bar at the front end Ajax
, each of which triggers an AJAX request. The backend specifically writes a public function to handle the front-end AJAX requests, using $this->load->view('xxx')
the completion of the main The container page is overloaded and implements PHP modularity (header.js/footer.js. etc).
Problem
Because each load of the container is different, the static files used such as css|javascript|img
loading in various container, so that the header and footer template can not be unified. If you write all the static resources in the template PHP, it will inevitably lead to the page 加载时间过长
.
Once thought of alternatives, each container add nav this tag, so that they can be loaded with different static resources, but after the molding of code maintenance is cumbersome, and code duplication is not efficient.
So want to ask if there is any better solution??