Monday, April 4, 2011
Wika 2011 Video on Youtube
Video follows:
Monday, September 13, 2010
Joomla 1.5 - Created date to mySql
To use a the current date/time in your JModel entended class, do the following.
In the store() method after the $row->bind() method, add:
//Get a JDate object
$createdate = &JFactory::getDate();
//Create a date in MySQL's datetime format
$row->created = $createdate->toMySQL();
//PS: make sure your table have a created field :)
Joomla!'s JDate also allows you to set custom Unix dates simply by passing in the date to JFactory::getDate() method. E.g.
$createdate =& JFactory::getDate(time());
Note that you wil override the date everytime you save to the database. See if you can modify the model to set the create date only on new saves. :)
See Joomla!'s API documentation for more on what JDate can do.Monday, September 6, 2010
Joomla 1.5 Additional select tag values
I normally use a value of 0 to indicate a search of "All Values".
The first thing you do is create a class at the top of your page as follows:
<?php
class MySelectObject{
var $id;
var $name;
}
?>
Then to use it do the following:
<?php
$db = &JFactory::getDBO();
$query = "SELECT `id`,`name` FROM
#__town";
$db->setQuery($query);
$townlist = $db->loadObjectList();/*Create an instance of MySelectObject*/
$mso = new MySelectObject();/*Set values*/
$mso->id = 0;
$mso->name = 'Any Town';/*Create an array for insertion*/
$tmpArr = array(0 => $mso);/*Merge with array result from query. Add to the front of list*/
$selectList =
array_merge($tmpArr,$townlist);/*Make MySelectObject the default selected*/
echo
JHTML::_('Select.genericlist',$selectList,'town',"","id","name",0);
?>
Wednesday, October 14, 2009
Joomla 1.5 - Creating RAW output for the front end
Monday, August 10, 2009
Joomla 1.5 Raising Errors, Notices and Warnings through code
Making use of Joomla!'s JError class it is possible to display this kind of messages theough the Joomla! framework. To use simply call the JError::raiseError, JError::raiseNotice or JError::raiseWarning methods.
<?php
$msg = 'Error Message';
JError::raiseError(0,$msg);
$msg = 'Notice Message';
JError::raiseNotice(0,$msg);
$msg = 'Warning Message';
JError::raiseWarning(0,$msg);
?>
[update - 11 Feb 2010]
For more go to the following url:
http://docs.joomla.org/Display_error_messages_and_notices