简体   繁体   English

如何在joomla 2.5文章选项中添加自定义字段?

[英]How to add a custom field in in joomla 2.5 article options?

I want to add a custom field to the article options in joomla. 我想在joomla中的文章选项中添加一个自定义字段。 It can be either in the "Article Options" or in a seperate form table. 它可以在“文章选项”中,也可以在单独的表格中。 I just need on single checkbox. 我只需要一个复选框。 How can this be done? 如何才能做到这一点? I searched in the web, but it's not possible to find a working solution. 我在网上搜索,但找不到可行的解决方案。

EDIT: I need to add a custom field in the backend. 编辑:我需要在后端添加一个自定义字段。 I'm writing a simple plugin, where I show a js widget, when it's enabled in the article options. 我正在编写一个简单的插件,其中在文章选项中启用了该插件,然后在其中显示js小部件。 Therefore I need a custom field (checkbox), to check, if the widget is enabled for this article. 因此,我需要一个自定义字段(复选框)来检查是否为本文启用了小部件。

Go to

administrator/components/com_content/models/forms/article.xml

Add your Custom Field under the 在下面添加您的自定义字段

<fields name="attribs">

Tag 标签

<field 
     name="your_custom_field_name"
     type="list"
     label="YOUR_CUSTOM_FIELD_NAME"
     description="YOUR_CUSTOM_FIELD_NAME">
         <option value="">JGLOBAL_USE_GLOBAL</option>
         <option value="0">JNO</option>
         <option value="1">JYES</option>
</field>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM