【问题标题】:how can I add menu item specific parameters and read them on joomla 2.5 menu?如何添加菜单项特定参数并在 joomla 2.5 菜单上阅读它们?
【发布时间】:2012-11-15 11:31:39
【问题描述】:

我在 joomla(2.5) 上进行了一些编程,我创建了一个组件,效果很好,现在我发现了一个问题......我需要该组件接收一个参数(来自 joomla 的菜单)并指示一个值,然后使用该值我将计算一些东西(如模块的参数)。

所以,经过搜索,我找到了这个文档

http://docs.joomla.org/Component_parameters

这很好(如果可以的话),但我有一个问题..我无法添加任何参数,我复制并粘贴了 XML 的代码,我应该在其中设置我的参数字段...并且不起作用,我尝试了我用于模块的字段,它确实出现了,但我无法阅读它们......

知道怎么做吗?

这是我的 xml。

<metadata>
  <state>
    <params>
    <param name="mytextvalue" type="text" default="Some text" label="Enter some text" description="" size="10" />
    </params>
  </state>
</metadata>

请帮忙

【问题讨论】:

    标签: php joomla joomla-component


    【解决方案1】:

    参数已从 1.6 及以上的 joomla 版本中删除。因此您必须改用 fieldset 和 field。 About Different Fields

    希望这对您有所帮助- How to creat new options to joomla component when creating new menu item

    【讨论】:

      【解决方案2】:

      创建一个名为 config.xml 的文件并将其添加到:

      <?xml version="1.0" encoding="utf-8"?>
      <config>
          <fieldset name="settings" label="Configuration Settings" description="Description Goes Here">
              <field name="mytextvalue" type="text" default="Some text" label="Enter some text" description="" size="10" />       
          </fieldset>
      </config>
      

      要查看参数,请在view.html.php文件的显示函数中添加JToolBarHelper::preferences('com_yourcomponentname');。这将在后端组件的工具栏上添加一个名为“选项”的按钮。点击查看参数。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-04-26
        • 2012-10-05
        • 1970-01-01
        • 2014-12-14
        • 2012-11-28
        • 2016-06-07
        • 2013-03-12
        • 2013-03-15
        相关资源
        最近更新 更多