The function of this article: display the topic title and topic content at the same time. If you want to directly see the project implementation results, you can directly look at the content under the title that solves the problem
Project requirements
This is the page layout of the original mobile terminal
This is the effect that needs to be achieved
Discover the problem
In the original `upload\template\default\touch\forum\viewthread.htm`
we can see that the title and content are displayed separately, and the final one is `$_G [forum_thread][subject]`
This variable
There is a problem at this time, that is, how to get out our theme content! Let’s first look at what the content variables of the source code are.
Coming to line 163 of `upload\template\default\touch\forum\viewthread.htm`
, we can see that `$post[message]`
What this variable implements
No matter what, try using this tag first and then talk
The problem is very obvious at this time. We used `$post[message]` but it displayed the last content of the topic. Then we will start to solve this problem. Problem
Solution
Since we have discovered the problem above, we will test it step by step based on this idea
Solution steps
Since In html, there is a problem when we use variables in the original template
Then we need to think about what variables we pass in the background
Whether the variable passed in contains the theme content Value
If it exists, just get it directly. If not, we need to solve it ourselves
Check which PHP file is used according to the request path
Check the address bar` forum/upload/forum.php?mod=viewthread&tid=13&pid=44&page=1&extra=&mobile=2#pid44`This is the address we need
You can see that `forum.php` is requested first, then we Just open this file
The last line of the file is the file we finally need to enter. You can print the mod variable to see what it is
According to the above Figure, we go directly to the file `upload/source/module/forum/forum_viewthread.php`, and you will see these two variables. Are these two variables very familiar? Aren’t these the two used in our template? Variable?
Let’s print these two variables
At this time we found There is no topic content field in the variable at all
Let’s first look at the topic content stored in the database table
Open the database dictionary `pre_forum_post` of discuz. This table is exactly what we need
Open the local database and we will find that isn’t this the data we need?
Without further ado, let’s just print out the parameters in the address bar
Directly query based on tid, and then Put the message field in, the time is what I need! You decide according to the situation
Then we call it in the template
Check the effect: This is us Desired results
The above is the detailed content of 【Discuz】Realize topic title and text to be displayed at the same time. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 Chinese version
Chinese version, very easy to use

Dreamweaver CS6
Visual web development tools

Notepad++7.3.1
Easy-to-use and free code editor

WebStorm Mac version
Useful JavaScript development tools
