如何保存用户主题 [英] How to save users theme

查看:92
本文介绍了如何保存用户主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图保存每个用户主题,但是它通过数据库失败了



我尝试了什么:



仍然是新鲜的PHP,我正在尝试制作一个简单的项目,帮助用户选择自己的主题和运行博客,我读了很多,找到2种方法来保存所选主题的文件夹每个用户的路径,从模板源复制到文件夹或通过数据库!!我能做这个项目的更好方法是什么?

i tried to save each user theme but it's failed through database

What I have tried:

am still fresh in php and am trying to make a simple project help users to choose their own theme and run the blog , i read a lot and found 2 ways to save the selected theme either by folder path for each user and copy from template source to there folders or through database !! what is the better way i can do this project ?

推荐答案

假设你在谈论基于CSS的主题,为什么要经历将其保存在在文件中引用它?



为表中的每个主题添加标记,以及每个主题的唯一引用ID。然后,当用户登录时,您可以阅读参考,从其记录中读取相应的主题数据,并在构建时将其插入.php页面。



一旦开始使用数据库存储,它通常是存储所有数据的最佳方式。



请注意,您可以在一个地方修改主题(与文件参考一样),所有选择该主题的人都会改变。

Assuming that you're talking about a CSS based theme, why go through the trouble of saving it in or referencing it in a file?

Have the markup for each theme in a table, along with a unique reference ID for each theme. Then, when a user logs in, you can read the reference, read the appropriate theme data from it's record, and insert it into the .php page when you build it.

Once you start using a database for your storage it's usually the best way to store all of your data.

Note that you can modify the themes in one place (like with a file reference) and it will change for all who select that theme.


这篇关于如何保存用户主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆