Wap webpage-thinkphp3.0 project already has pc end how to add mobile version website?

Source: Internet
Author: User
For example, in the project directory structure below, how to configure the mobile website to find an is_mobeli () function on the Internet to determine how to configure it?

Example

In the following project directory structure, how to configure mobile websites? on the Internet, I found an is_mobeli () function to determine how to configure it.

Reply content:

Example

In the following project directory structure, how to configure mobile websites? on the Internet, I found an is_mobeli () function to determine how to configure it.

You mean to create another module, which then displays the wap page. the page entry is determined based on is_mobile. now you have an App in BIND_MOUDLE.

Determine where the entry file is located. It is best to rewrite the controller on the mobile phone end separately. of course, if the gap between the mobile phone end and the PC end is not very large, you can also use the same set.

When we do this, PC-side pages all inherit from the content such as header footer in Base/PcBase.html and PcBase.html. Then, put the js script in pcbase.html to check whether it is a mobile device. if it is a mobile device, it automatically jumps to the mobile terminal.
Depending on the size of your project, if the project is not large, you can directly create a ller lecontoler in the Home. if the project is large, pull a MobileMoudle.
We did not use is_mobile, but determined it using js scripts. That is what you like.

Is it a thinkphp3.0 Old project.

First, append a Mobile group in config. php, and set the command as follows:

'APP_GROUP_LIST' => 'Admin,Home,Member,Mobile'

Then, append the Mobile directory to the Action, append the Mobile directory to the Tpl, and continue the development of various controllers, models, and views.

Finally, if all of your Home groups inherit a base class, for example

class IndexAction extends BaseAction {

Then you add the is_mobile function judgment to the _ initialize function in BaseAction, so that all controller requests will trigger the judgment.

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.