Wednesday, 26 January 2011

Module to record the username of a user when they access a page?

We've been asked to come up with a module that can be embedded in a page and will insert into a database table the username of the user accessing that page.  I've tried Google searching but can't find anything.

I did find a forum post that talks about doing something similar:
  • Create the table using:
    CREATE TABLE `databasename`.`jos_names` (`id` int(11) NOT NULL auto_increment, `firstname` VARCHAR(100), `lastname` VARCHAR(100), PRIMARY KEY  (`id`) )

  • Then write your module using: $db =& JFactory::getDBO();
    $query = "INSERT INTO `#__names` (`fname`, `lname`)
    VALUES ($fname, $lname);";
    $db->setQuery( $query );
    $db->query();

Thursday, 6 January 2011

Load Position

A colleague just showed me something useful.


If you want to load a module within an article:
  • In the module set the position to one that doesn't exist as a position in your template, e.g. InTheMiddleOfMyArticle
  • In the article use the loadposition tag to put it where you want, e.g. {loadposition InTheMiddleOfMyArticle}
  • Check the page with the article and the module should be there.

Tuesday, 9 November 2010

Interesting

It seems that whilst Joomla is free if you want to create your own template to make it look how you want you've gotta pay $129.99 for the software to do so or hand craft the PHP yourself.  That or all the free Joomla template editors are hiding from Google.

Thursday, 4 November 2010

Another piece of work, another blog

I was recently informed I'm to assist in maintaining a site based on Joomla.  This will involve learing all about Joomla so I've registered a domain (sbjoomla.org.uk) and signed up with a hosting service that supports it.  Just waiting for the domain registration to percolate through so I can start using it.

Suppose I'd better find out what this Joomla thing is!