Table of Contents
Project requirements
Discover the problem
Solution
Solution steps
Home CMS Tutorial Discuz 【Discuz】Realize topic title and text to be displayed at the same time

【Discuz】Realize topic title and text to be displayed at the same time

Apr 29, 2020 pm 01:56 PM
discuz

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

【Discuz】Realize topic title and text to be displayed at the same time

This is the effect that needs to be achieved

【Discuz】Realize topic title and text to be displayed at the same time

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

【Discuz】Realize topic title and text to be displayed at the same time

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

【Discuz】Realize topic title and text to be displayed at the same time

No matter what, try using this tag first and then talk

【Discuz】Realize topic title and text to be displayed at the same time

【Discuz】Realize topic title and text to be displayed at the same time

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

【Discuz】Realize topic title and text to be displayed at the same time

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?

【Discuz】Realize topic title and text to be displayed at the same time

Let’s print these two variables

【Discuz】Realize topic title and text to be displayed at the same time

【Discuz】Realize topic title and text to be displayed at the same time

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

【Discuz】Realize topic title and text to be displayed at the same time

Open the local database and we will find that isn’t this the data we need?

【Discuz】Realize topic title and text to be displayed at the same time

Without further ado, let’s just print out the parameters in the address bar

【Discuz】Realize topic title and text to be displayed at the same time

Directly query based on tid, and then Put the message field in, the time is what I need! You decide according to the situation

【Discuz】Realize topic title and text to be displayed at the same time

Then we call it in the template

【Discuz】Realize topic title and text to be displayed at the same time

Check the effect: This is us Desired results

【Discuz】Realize topic title and text to be displayed at the same time

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!

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Discuz background login problem solution revealed Discuz background login problem solution revealed Mar 03, 2024 am 08:57 AM

The solution to the Discuz background login problem is revealed. Specific code examples are needed. With the rapid development of the Internet, website construction has become more and more common, and Discuz, as a commonly used forum website building system, has been favored by many webmasters. However, precisely because of its powerful functions, sometimes we encounter some problems when using Discuz, such as background login problems. Today, we will reveal the solution to the Discuz background login problem and provide specific code examples. We hope to help those in need.

Detailed explanation of Discuz registration process: allowing you to easily modify personal information Detailed explanation of Discuz registration process: allowing you to easily modify personal information Mar 13, 2024 pm 12:21 PM

"Detailed Explanation of Discuz Registration Process: Allowing you to easily modify personal information, specific code examples are required" Discuz is a powerful community forum program that is widely used in various websites. It provides a wealth of user registration and personal information modification. functions and interfaces. This article will introduce you to Discuz's registration process in detail and provide specific code examples to help you easily customize and modify your personal information. 1. User registration process In Discuz, user registration is one of the important functions of the site. The smoothness of the registration process and

What is Discuz? Definition and function introduction of Discuz What is Discuz? Definition and function introduction of Discuz Mar 03, 2024 am 10:33 AM

"Exploring Discuz: Definition, Functions and Code Examples" With the rapid development of the Internet, community forums have become an important platform for people to obtain information and exchange opinions. Among the many community forum systems, Discuz, as a well-known open source forum software in China, is favored by the majority of website developers and administrators. So, what is Discuz? What functions does it have, and how can it help our website? This article will introduce Discuz in detail and attach specific code examples to help readers learn more about it.

A must-have for Discuz users! Comprehensive analysis of renaming props! A must-have for Discuz users! Comprehensive analysis of renaming props! Mar 12, 2024 pm 10:15 PM

A must-have for Discuz users! Comprehensive analysis of renaming props! In the Discuz forum, the name change function has always received much attention and demand from users. For some users who need to change their name, name change props can easily modify the user name, and this is also an interesting way of interaction. Let’s take an in-depth look at the renaming props in Discuz, including how to obtain them, how to use them, and solutions to some common problems. 1. Obtain name-changing props in Discuz. Name-changing props are usually purchased through points or the administrator

What should I do if I encounter an incorrect Discuz password? Quick solution sharing! What should I do if I encounter an incorrect Discuz password? Quick solution sharing! Mar 03, 2024 am 09:33 AM

What should I do if I encounter an incorrect Discuz password? Quick solution sharing! Discuz! It is a very popular forum program that provides users with a platform for convenient communication. Using Discuz! When accessing a forum, sometimes you may encounter an incorrect password, which may cause users to be unable to log in and use the forum normally. Well, meet Discuz! When the password is wrong, how should we quickly solve the problem? Some solutions will be shared below, with specific code examples provided for reference. 1. Check whether the password

Solve the problem that Discuz WeChat sharing cannot be displayed Solve the problem that Discuz WeChat sharing cannot be displayed Mar 09, 2024 pm 03:39 PM

Title: To solve the problem that Discuz WeChat shares cannot be displayed, specific code examples are needed. With the development of the mobile Internet, WeChat has become an indispensable part of people's daily lives. In website development, in order to improve user experience and expand website exposure, many websites will integrate WeChat sharing functions, allowing users to easily share website content to Moments or WeChat groups. However, sometimes when using open source forum systems such as Discuz, you will encounter the problem that WeChat shares cannot be displayed, which brings certain difficulties to the user experience.

Discuz Editor: Powerful web page editing tool Discuz Editor: Powerful web page editing tool Mar 09, 2024 pm 06:06 PM

Discuz Editor: A powerful web page editing tool that requires specific code examples. With the development of the Internet, website construction and content editing have become more and more important. As a common web page editing tool, Discuz editor plays an important role in website construction. It not only provides a wealth of functions and tools, but also helps users edit and publish content more conveniently. In this article, we will introduce the features and usage of the Discuz editor, and provide some specific code examples to help readers better understand and use

Discuz background account login exception, how to deal with it? Discuz background account login exception, how to deal with it? Mar 09, 2024 pm 05:51 PM

Title: Discuz background account login exception, how to deal with it? When you use the backend management of the Discuz forum system, you may sometimes encounter abnormal account login. This could be due to a variety of reasons, including a wrong password, account being blocked, network connection issues, etc. When encountering this situation, we need to solve the problem through simple troubleshooting and processing. Check whether the account number and password are correct: First, confirm whether the account number and password you entered are correct. When logging in, make sure the capitalization is correct and the password is

See all articles