如何从joomla 3.1中的templateDetails.xml获取params

时间:2013-10-08 08:50:13

标签: php xml joomla parameters

我想在模板中使用params表单templateDetail.xml来使用它。但每次我做

$this->params->get('Title', 'test');

我只是接受考试,似乎他找不到参数标题。

这是我的templateDetail.xml

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE install PUBLIC "-//Joomla! 2.5//DTD template 1.0//EN" "http://www.joomla.org/xml/dtd/2.5/template-install.dtd">
<extension version="3.0" type="template" client="site">
  <name>Basic Joomla 3.0 Template</name>
  <version>1.0</version>
  <creationDate>10/04/2012</creationDate>
  <author>Gazar</author>
  <authorEmail>info@gazar.nl</authorEmail>
  <copyright>Copyright (C) 2013 Gazar</copyright>
  <description>My first JOOMLA template!</description>
  <files>
    <filename>index.php</filename>
    <folder>css</folder>
    <folder>js</folder>
    <folder>fonts</folder>
  </files>
  <positions>
        <position>debug</position>
        <position>hoofdmenu</position>
        <position>slider</position>
        <position>position-0</position>
        <position>position-1</position>
        <position>position-2</position>
        <position>position-3</position>
        <position>position-4</position>
        <position>position-5</position>
        <position>position-6</position>
        <position>position-7</position>
        <position>position-8</position>
        <position>position-9</position>
        <position>position-10</position>
        <position>position-11</position>
        <position>position-12</position>
        <position>position-13</position>
        <position>position-14</position>
  </positions>
    <config>
        <fields name="params">
            <field name="Title" type="text" default="Gazar" label="Title" description="Vul hier de titel van uw site in!" />    
        </fields>
    </config>
</extension>

任何知道如何做到这一点的人?

PS:我是否必须告诉JOOMLA哪里设置了参数?或者JOOMLA知道他需要查看templateDetails.xml吗?

1 个答案:

答案 0 :(得分:1)

试试这个,

您错过了xml中的fieldset标记

<fields name="params">
        <fieldset name="advanced">
                    <field name="title" type="text" default="Gazar" label="Title" description="Vul hier de titel van uw site in!" />  
        </fieldset>
            </fields>

并尝试参数

echo $this->params->get('title');