Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of autonomous control of bullet frame display by discuz

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail the method of discuz autonomous control pop-up box display for you. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Implement the function:

Control whether the bullet box is displayed or not

Function usage scenario

As written in a previous article, discuz implements automatic registration and login. But we don't want that hint to come out.

A general search on the Internet, some said that the background can be set, but click to take a look at the back, its setting is only for some fixed scenes.

Then we can write a display that is suitable for our project.

Analysis of the realization of pop-up frame

Anyone who uses discuz for a period of time knows that the pop-up box of the foreground is actually determined by the method of background showmessage.

We use code to trace this method to about 1424 lines in the upload/source/function/function_core.php file.

And then we're tracking dshowmessage.

Finally, the file for this method is here in upload/source/function/function_message.php.

Then we pull the code to the end, and we can see a variable for show_messge and a template address loaded.

At this time, we go to find the location of the template: upload/template/default/touch/common/showmessage.htm.

In this template we can see that a variable is show_message.

To confirm that the show_message in the template is consistent with the show_message in the PHP file, let's do a test.

Modify: line upload/source/function/function_message.php 238

Then there is no problem with the test results on the page. The two variables are consistent.

Realize your own display mode

After the above test, we know that the show_message of line 238 of the upload/source/function/function_message.php file is the same as the show_message of the template upload/template/default/touch/common/showmessage.htm.

Then we can declare a variable, declare a variable if you want to display your own style, and then control it in the template.

Here is a case study of Kaka: as long as you have this requirement, this solution of Kaka can solve your problem at 100%.

This code is to determine whether the user has registered or not, and if so, log in directly. There is no need to struggle here, Kaka's case comes from the original system.)

You can see that in showmessage I added a variable called is_login with a value of 1

Since we need to use this value in the template, we will follow suit and declare is_login as a global variable in the upload/source/function/function_message.php file.

Then take this value and you can use it in the upload/template/default/touch/common/showmessage.htm template.

Just add your own if to this.

Another very simple way is to control the entry template on line 239 upload/source/function/function_message.php.

So what do you need to do at this time? This is the template.

Copy the showmassge file under the upload/template/default/touch/common directory

Then modify the file so that you can jump directly after entering.

Realize the effect

The pop-up box is gone when you log in.

There should be some in other places.

After all the files in this article have been modified! If you want to use a self-defined template later, you can use it directly.

Is_login is a logo of your custom template.

Showmessage ('login_succeed',' forum.php', ['username'= > $username,'is_login'= > 1], array (' showdialog' = > 1)); this is the end of the method of discuz autonomous control of pop-up box display. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report