Home >CMS Tutorial >Discuz >How Discuz develops mobile guest functionality

How Discuz develops mobile guest functionality

咔咔
咔咔Original
2020-05-13 17:49:132737browse

The functions implemented in this article:

Development tips There is currently no mobile page

The implementation case is the development space visitor function

discuz in The functions of the mobile terminal are really very simple, basically just a few pages. Many functions of the PC terminal are not implemented at all, especially the personal space page. There is almost no operation at all on the mobile terminal. Next, Kaka will record the implementation steps, hoping to help more developers.

Implementation steps

We will use the visitor function as a case

How Discuz develops mobile guest functionality

When we When this PC address is accessed by the mobile terminal, the following situation will occur, prompting that there is no page on the mobile terminal

How Discuz develops mobile guest functionality

Why the same address can be accessed by the PC terminal, but cannot be accessed by the mobile terminal It cannot be accessed. With this question, we came to the project directory.

This is the personal space directory on the PC side

How Discuz develops mobile guest functionality

This is all the pages of the personal space on the mobile side. Have you come to your senses at this time? There are only a few pages on the mobile terminal!

How Discuz develops mobile guest functionality

Following the information given in the address bar, we started to find the corresponding page home.php?mod=space&uid=1&do=friend&view=visitor&mobile=2

We can know based on the information given in this address bar. The initial program is in home.php and then distributed from home.php. Here we can see mod=space

How Discuz develops mobile guest functionality

Then in the last line of the home.php file, we can see that a file is loaded, follow this prompt to continue Find relevant documents.

How Discuz develops mobile guest functionality

According to the above prompts, we will come to the file source/module/home/home_space.php. In this price inquiry, we will find the friend module

How Discuz develops mobile guest functionality

Then at the end of the file, require_once libfile('space/'.$do, 'include');

## is loaded. How Discuz develops mobile guest functionality

#Following this prompt message, we can find source/include/space/space_friend.php

How Discuz develops mobile guest functionality

Then around line 86 of the file, you You can see such information, here is the visitor data we need


How Discuz develops mobile guest functionality

Then on line 254 of this file, we see the html file he loaded It’s the home/space_friend file


How Discuz develops mobile guest functionality

You should have already figured it out when you get here. You can go back and look at the PC and mobile space directories above. It's because there is no space_friend template file under the home of the mobile terminal.

Next we will develop this page step by step

Implement visitor records


According to our analysis above, we will add a space_friend page in the directory of the mobile terminal Let’s test it

How Discuz develops mobile guest functionality

At this time, just visit it

How Discuz develops mobile guest functionality

Then start writing our page , this is the page that Kaka has developed

How Discuz develops mobile guest functionality

Regarding the rendering data, we can come to the page rendering on the PC side

How Discuz develops mobile guest functionality

On the PC side, list is used, then we also use list

How Discuz develops mobile guest functionality


##Then you can open the database dictionary and find the space access log


How Discuz develops mobile guest functionalityComing to the database

How Discuz develops mobile guest functionality

Summary

The above is how Discuz develops a guest page that prompts you that the page you are visiting does not have a mobile phone page

The above is the detailed content of How Discuz develops mobile guest functionality. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn