July 5, 2006 - kenshinjeff

joomla tutorial basic tips

Instead of diving straight into the component / module codes, here’s a rundown on what you need to know for coding it.

Note: If you do not know php and mysql at all, I would suggest you just employ someone to code it for you before you break anything in Joomla. It is not exactly that easy to wade through code someone else wrote if you don’t have prior experience.

All database calls can be used like this, in any page that you have coded, be it a component or module or plugin.

global $database;
$database->setQuery( "SELECT * FROM #__users" );
$results = $databage->loadObjectList();
foreach ( $results as $result ) {
echo $result->username;
}

  • First off, the database object has encapsulated all the database api stuff you’ll need, including retrieving the autonumber.
  • #__ will translate to jos_ when the query executes itself via loadObjectList();
  • $result->columnname will retrieve the value of the given columnname

Some other built in stuff which you might want to look at:


$category = mosGetParam( $_REQUEST, 'category', "0" );

  • To make it Joomla code look consistent, just follow their convention : D
  • First parameter is the type, usually $_GET / $_POST / $_REQUEST / blahblah
  • 2nd param is of course, the name of the paramter
  • Somehow the third param doesn’t always work for me. I didn’t read the constructor code for mosGetParam, but it _should_ be the default value if category returns a null value
  • Sometimes, there’s a type cast before mosGetParam, but I suppose that’s not really useful since php does auto typing.

I’ll update this post as I think of more stuff to write. I have to figure out the order of which tutorial to write too you know : DDDDDD

incomplete / joomla

Leave a Reply

Your email address will not be published. Required fields are marked *