drupal 中不经常更改的数据 - 如何正确执行?
我得到了一个表单(使用表单 api 和 drupal_Get 表单),我得到了一个包含 50 个字段的表单,其中一些是不经常更改的数据,例如爱好、出生年份、城市/国家等... 我目前只将它们放在文件的数组中并将它们放入 #options=>$array ...这是节省资源的最快方法吗?或者我应该使用分类/变量集/数据库查询/块/节点或其他什么?
i got a form (using form api and drupal_Get form ) and i got a form with 50 fields and some of them are non frequently chaning data like hobbies, year of birth , city/country etc...
i currently do just them in array in file and put them in #options=>$array ... is that the fastest way to save resources? or should i use taxonomy/variable_set/database query/block/node or whatever?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
variable_get/variable_Set
:通常用于存储站点的管理员首选项。如果这些是特定于用户的,我认为使用variable_set保存它们不是一个好主意taxonomy
:也可以用于填充值下拉菜单,用于列表中的选项。根据您的情况创建一个词汇表
称为爱好并添加
游泳、阅读、drupaling 作为术语。
然后使用内容分类
使用 CCK 模块将分类术语用作下拉菜单。
节点
:任何用户的东西Specific 应该作为节点进入。和
任何可以创建的内容
用户也应该作为节点进入。
variable_get/variable_Set
: Is generally used to store admin preferences for the site. If these are user specific I don't think it's a good idea to save them using variable_settaxonomy
: Can also be used for populating the values ofdrop-downs, that is for options in the listing. In your case create a vocabulary
called hobbies and add
swimming,reading,drupaling as terms.
Then use the content-taxonomy
to use taxonomy terms as drop downs using CCK moudule.
nodes
: Anything that is userspecific should go in as nodes. And
any content that can be created by
the users should also go in as nodes.
要管理表单,您可以使用 variable_set/ variable_get。
但是对于您的任务来说,用户似乎输入了他们的个人简介,因此在这种情况下,您应该将每个表单提交存储到新的“行”,就像您现在对文件所做的那样(想知道为什么不使用数据库存储)。
For administering forms you can use variable_set/variable_get.
But for your task it seems like that users enter their bio, so in this case you should store each form submission to new "row", as you do now for file (wonder why you don't use DB storing).