如何在Joomla 1.6文章编辑器中插入自定义字段?

3

我希望能在Joomla 1.6管理区域的文章编辑页面中插入自定义字段,请参阅截图。

http://screencast.com/t/vtLEBdUK

我尝试编辑myjoomlasite/administrator/components/com_content/models/forms/article.xml文件。 我可以在文章选项字段集中添加一个字段,但不能在主编辑区域中添加。
3个回答

3
在管理页面中插入自定义字段,需要更改两个文件。
  1. myjoomlasite/administrator/components/com_content/models/forms/article.xml

    add your field name like below code

    <field name="name" type="text" label="JGLOBAL_NAME"
        description="JFIELD_NAME_DESC" class="inputbox" size="30"
        required="true" />
    
  2. myjoomlasite/administrator/components/com_content/views/article/tmpl/edit.php

    add your label and input field

    <?php echo $this->form->getLabel('name'); ?>
    <?php echo $this->form->getInput('name'); ?>
    

您还需要在/components/com_content/models/article.php文件的第84行左右添加对新字段的引用。 - ams
这个答案有一点小缺陷,就是在新文章发布页面中添加了自定义字段,但在编辑/更新文章页面中却看不到它。 - uzair
+1 谢谢伙计!我已经想破头了两天! - talha2k

3
我不建议修改核心文件来实现您想要的功能。
您可以使用 Joomla 的一个 CCK(内容构建工具包)来创建您的内容模板。
Joomla 最好的免费 CCK:
  1. Form2Content(我最喜欢的)
  2. K2(最受欢迎,强烈推荐)
您可以在 Joomla 扩展目录 中找到更多。

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接