如何将自定义字段添加到 IPB 中的表单
哇,我很惊讶对 Invision Power Board 的支持如此缺乏(它是付费软件!)。
我只是找不到我想做的事情的文档,我正在谈论我可以使用任何其他论坛软件在五分钟内完成的事情。
无论如何,问题是: 基本上我需要将自定义表单字段(选择菜单)添加到论坛的“新主题”页面。我在 postFormTemplate 模板中添加了一个 select 标记,并且还创建了一个子类 public_forums_post_post 类的挂钩。 我正在重写 saveForm 函数,它允许我保存我添加的这个新字段的值。
问题是:如何设置它的初始值?即,是否有任何 loadForm 函数或类似的函数,它允许我加载字段的初始值,然后将其传递给模板? 我希望我的问题足够清楚。请询问您是否需要澄清。
Wow, I'm quite amazed that support for Invision Power Board is so lacking (it's paid software!).
I just can't find the documentation for what I want to do, and I'm talking about stuff I could do in five minutes with any other forum software.
Anyway, the question:
basically I need to add a custom form field (a select menu) to the 'New Topic' page in my forum. I added a select tag in the postFormTemplate template, and I've also created an hook subclassing the public_forums_post_post class.
I'm overriding the saveForm function which allows me to save the value of this new field I added.
The problem is: how do I set its initial value? i.e., is there any loadForm function or something like that, which would allow me to load an initial value for the field and then communicate it to the template?
I hope my question is clear enough. Please ask if you need clarification.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我同意 Endophage,尽管您可能想查看 这篇文章。它为您需要执行的操作提供了足够的文档。
模板挂钩正是您所需要的。但是,如果您需要向注册表添加自定义字段,ACP 中有一个内置函数。
I agree with Endophage, though you may want to look at this article. It provides enough documentation for what you need to do.
A template hook is exactly what you need. However, if you need to add custom fields to the registration form, there's a function built-in to the ACP.