The functions implemented in this article:
Develop a mobile fan page
Develop a mobile fan page
Realize that all the watch lists you see from your own space are shown as followed
# Realize that when you look at other people’s watch lists, the users you follow are shown as followed and the users you are not following are shown Show attention
Solution to how to display the mobile page in the PHP file
source/module/home/home_follow.php This file. In this file, we only need to notice the names follow and following. One of these two means attention, the other means fans
Then we go to the template according to the access mechanism of discuz Find the file follow_follower.html. But in the template we found that the files starting with follow are just these
## Continue to the file source/module/ Home/home_follow.php and then scroll to the end to see the loaded template. Here you can see that the loaded template is the follow_feed.html file seen above.
Then we come to the file template/default/home/follow_feed.htm. You can see two familiar modules and one follower around line 554. and following
Now that you have guessed it is here, write a test code to test it.
After testing, we are convinced that this page is the loaded follow page and fan page.
#The above test will find the address request The one is /home.php?mod=follow&do=follower, but the html file loaded is template/default/home/follow_feed.htm. That is to say, if you need to load a file that is inconsistent with the requested address in dsicuz, you need to use the template function to load it.
Then let’s write a mobile follow_follower file ourselves.
Then adjust the browser to mobile access mode
##The above is how to load the second follow page and fan page in PHP
Develop fan pages and follow pages and implement data access
The picture below is the effect of the follow page developed by Kaka
After the page is written, we need to implement data docking. Continue back to the template/default/home/follow_feed.htm file. You can see that the data used is list, and the variable fuser is used in the loop.
##Open the discuz database dictionary and you can see whether the focus is using the mutual field.
When you enter someone else’s space to view the follow list, if the user you are following needs to be shown as followed, otherwise it will be shown as followed. The judgment condition here is $_G [uid] != $_GET[uid], mutual==-1 or mutual==1 is enough. Why is there a mutual=-1 flag here? The database dictionary does not have this logo, but the actual test results show that it does. Kaka also looked at the source code and made a judgment. Just know how to judge first.
// 粉丝模板 <p class="follow_manage"> <!--{if $fuser[mutual] == -1 || $fuser[mutual] == 1}--> <a id="a_followmod_{$fuser['uid']}" href="home.php?mod=spacecp&ac=follow&op=del&hash={FORMHASH}&fuid=$fuser['uid']&mobile=2" class="flw_btn_fo dialog"> <i class="iconfont icon-like_fill rq"></i> <font class="grey">已关注</font> </a> <!--{else}--> <a id="a_followmod_{$fuser['uid']}" href="home.php?mod=spacecp&ac=follow&op=add&hash={FORMHASH}&fuid=$fuser['uid']&mobile=2" class="flw_btn_fo dialog"> <i class="iconfont icon-like"></i> <font class="grey">关注</font> </a> <!--{/if}--> </p> // 关注列表模板 <p class="follow_manage"> <!--{if $_G[uid] != $_GET[uid]}--> <!--{if $fuser[mutual] == -1 || $fuser[mutual] == 1}--> <a id="a_followmod_{$fuser['followuid']}" href="home.php?mod=spacecp&ac=follow&op=del&hash={FORMHASH}&fuid=$fuser['followuid']&mobile=2" class="flw_btn_fo dialog"> <i class="iconfont icon-like_fill rq"></i> <font class="grey">已关注</font> </a> <!--{else}--> <a id="a_followmod_{$fuser['followuid']}" href="home.php?mod=spacecp&ac=follow&op=add&hash={FORMHASH}&fuid=$fuser['followuid']&mobile=2" class="flw_btn_fo dialog"> <i class="iconfont icon-like"></i> <font class="grey">关注</font> </a> <!--{/if}--> <!--{else}--> <!--{if $fuser[mutual] == 0 || $fuser[mutual] == 1}--> <a id="a_followmod_{$fuser['followuid']}" href="home.php?mod=spacecp&ac=follow&op=del&hash={FORMHASH}&fuid=$fuser['followuid']&mobile=2" class="flw_btn_fo dialog"> <i class="iconfont icon-like_fill rq"></i> <font class="grey">已关注</font> </a> <!--{else}--> <a id="a_followmod_{$fuser['followuid']}" href="home.php?mod=spacecp&ac=follow&op=add&hash={FORMHASH}&fuid=$fuser['followuid']&mobile=2" class="flw_btn_fo dialog"> <i class="iconfont icon-like"></i> <font class="grey">关注</font> </a> <!--{/if}--> <!--{/if}--> </p>
Draw a picture to explain the logical processing that the user is concerned about
The above is the detailed content of Discuz mobile terminal second launch: follow and fan pages and follow status processing. For more information, please follow other related articles on the PHP Chinese website!