【问题标题】:mysql structure for dynamic template css (template framework)动态模板css的mysql结构(模板框架)
【发布时间】:2012-11-08 10:26:09
【问题描述】:

我正在尝试创建一个从数据库中检索内容的动态 cssFile.php。 使用这个框架,我应该能够更改一些全局 css 属性和一些其他属性,例如使用 html 表单定位和调整它们的大小,但我不知道如何在数据库中构造数据,甚至不知道如何创建一个好的布局。 数据库表应该是这样的:

+-------+------------+---
| color | background | ...
+-------+------------+---
| red   | #fff       |
+-------+------------+---

或者像这样:

+--------+----------+-------+
| class  | property | value |
+--------+----------+-------+
| .class | color    | red   |
+--------+----------+-------+

【问题讨论】:

  • 第二个似乎更有意义,也许将“类”替换为“标识符”,这样您就可以使用 Id、元素和其他选择器而不仅仅是类
  • 但是更新属性怎么样,例如有一天我设置了 margin: 0px,另一天我将它设置为 10px,它会插入 2 行,数据会很乱,并且会增加数据库大小
  • UPDATE where class=.class and property=property and value=value?

标签: php html mysql css templates


【解决方案1】:

像这样的布局会很好。

CSS_type - 表格

+--------+----------+
| id     | type     |
+--------+----------+
| 1      | .class   |
+--------+----------+

CSS_main - 表格

+--------+----------+-------+------------+
| type   | property | value |  type_name |......
+--------+----------+-------+------------+
| 1      | color    | red   | container  |......
+--------+----------+-------+------------+

...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-08-19
    • 2013-10-31
    • 2017-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多