Page 1 of 1

Parameter Error

Posted: Thu Aug 14, 2008 9:23 pm
by omn3s
So I looked up how to add parameters in the joomla wiki, and here's the code I'm using:
<?php if ($this->params->get( 'front' )){ ?>content<?php }else{ ?>pagecontent<?php } ?>


However it's throwing me this error:
Fatal error: Using $this when not in object context in /home/test/public_html/joomla/templates/test/index.php on line 45

What's the correct syntax for using a parameter?

Re: Parameter Error

Posted: Thu Aug 14, 2008 9:27 pm
by Gergo Erdosi
Could you please describe which parameters would you like to get?

Re: Parameter Error

Posted: Thu Aug 14, 2008 9:33 pm
by omn3s
I created the parameters...they're in the xml file and i created a params.ini file

<params>
<param name="front" type="radio" default="1"
label="Front Page" description="decides if its the front page.">
<option value="0">hide</option>
<option value="1">show</option>
</param>
</params>

Re: Parameter Error

Posted: Fri Aug 15, 2008 8:27 am
by Gergo Erdosi
But what's this? A module? If yes, you can access the parameters like this:

Code: Select all

function yourmodule( $params ) {
  $front = $params->get('front');
}