|
The next improvement I am thinking of is to try having textareas (multiline) instead of text boxes and what else, let’s try radio buttons as well. We can have a YES/NO option for the administrator to decide if she wants to salute users or not depending on her mood. Now I am not sure how to do this so, I’ll have a look at other modules that use radios. Hmm, mod_login does use radios! OK, replace your xml params section with the following: <params> <param name="tosalute" type="radio" default="1" label="Salute users?" > <option value="0">No</option> <option value="1">Yes</option> </param> <param name="saluteguest" type="textarea" default="" rows="4" cols="40" label="Guest users salute" description="Salute text for guests" /> <param name="saluteregistered" type="textarea" default="" rows="4" cols="40" label="Registered users salute" description="Salute text for registered users" /> </params> This is what you ‘ll get.
OK, now you want to use this, don’t you? <?php defined('_JEXEC') or die('Restricted access'); $user =& JFactory::getUser(); # Get backend parameters $tosalute = $params->get("tosalute"); $saluteg = $params->get("saluteguest"); $saluter = $params->get("saluteregistered"); if ($tosalute) { if ($user->guest) echo "<p>$saluteg</p>"; else echo "<p>$saluter</p>"; } else echo "<p>I am in a really bad mood<p>"; ?> Well, there are other controls for using at the backend but, you know, after two examples for the same thing it gets a byte boring. You can visit this link to see what controls are available and this one for some more examples. At least we have what we need for now to keep going. Onto database access! |