Home > Backend Development > PHP Tutorial > ThinkPHP realizes the method of permanently modifying the front-end view page in the visual background management_PHP tutorial

ThinkPHP realizes the method of permanently modifying the front-end view page in the visual background management_PHP tutorial

WBOY
Release: 2016-07-13 09:54:26
Original
1286 people have browsed it

ThinkPHP realizes the method of permanently modifying the front-end view page in the visual background management

I have been wondering about the issue, that is, like csdn, users can modify their own homepage style, and the modification is permanent. Many places have invited people to hand over the view style to the user. This is also the future. The development trend, like QQ space decoration, and even the backend of some website building programs are like this, so it is very important to understand this principle.

First of all, this is obviously impossible to achieve through the front end, because the things in the front end are ultimately placed in the memory when they reach the user. The memory is volatile, so it should be placed in the background. Similarly, we cannot To directly modify the background files, which is very costly, then we need to put them into the database. The data in the database is stored in the hard disk and is not easy to lose. Moreover, it is also easy to operate through the background files. In this case, the idea is .

In the background visual management interface, various styles of buttons, forms, etc. are stored, including specifically modified pages. In the database, the style data of the foreground view is stored. There is a missing connection in the middle, but smarty is perfect. It solves this problem and separates the data. Modification means modifying the database data, and extraction means extracting the database style. This is the core principle.

Here is a sample code of mine for reference only:

<!--?php
namespace Home\Controller;
use Think\Controller;
class TestController extends Controller {
   	public function test1(){
   		$info=D("style");

   		$temp=$info--->select();
   		$info->id=&#39;2&#39;;
   		$info->value=$_POST[value];
   		$info->save();
   		$bg=$temp[1][&#39;value&#39;];
   		$size=$temp[4][&#39;value&#39;];
   		echo $bg;
   		echo "
";
   		echo $size;
   		$this->assign(bg,$bg);
   		$this->assign(size,$size);
   		$this->display();
   	}

}
Copy after login

Copy after login
Test Match

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/997427.htmlTechArticleThinkPHP implements a method to permanently modify the front-end view page in the visual background management. I have been wondering about things like Like csdn, users can modify their own homepage...
Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template