This article explains how to modify the theme views through a simple php file.
Many webmasters need to be able to modify the page views of a theme under certain specific needs, but they don’t know how to do it. This article introduces a method of modifying the page views of a theme through a simple file;
Create a file, such as: threadviews.php
Write the following code
<!--?php define('APPTYPEID', 127); define('CURSCRIPT', 'threadviews'); require './source/class/class_core.php'; $discuz = & discuz_core::instance();$discuz--->cachelist = $cachelist;$discuz->init();
//The following is the post tid to be modified, change it to the one you want to modify
$tid=123;
//The following is the target pageviews to be modified
$views=999; DB::update('forum_thread',array('views'=>$views),array('tid'=>$tid)); C::t('forum_thread')->clear_cache($tid); echo 'ok'; ?>
Then upload threadtime.php to the root directory of your forum (i.e. the same as forum.php, home.php Directory)!
Open the URL in the browser: http://your domain name/threadviews.php
When you see the page outputs ok, the modification is successful!
The above code can modify the page views of one topic at a time. If you need to modify it in batches, you can use a plug-in. The Discuz! Application Center has a plug-in that can modify the page views in batches.
This article introduces how to modify the theme views through a simple PHP file. For more related content, please pay attention to the PHP Chinese website.
Related recommendations:
php object-oriented selection sorting example explanation
PHP Tips: Cleverly use json_encode() to assign values to js arrays
The above is the detailed content of Discuz! Tutorial: How to modify theme views through a simple php file?. For more information, please follow other related articles on the PHP Chinese website!