CI Framework questions about navigating the navigation bar to switch pages

Source: Internet
Author: User
Tags codeigniter

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??

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.