Since users can specify the time zone in which they are located, using their
timezone parameter, we can easily apply this or the site offset. When we use the
getParam() method to get the value of a user's parameter, if the parameter is not
set, null is returned.
The date type works in such a way that if a null value is given as the offset the site
offset is used. This example demonstrates how we can apply the user's offset or the
default site offset when using the date type:
// get the date and time of the request
$date = $mainframe->get('requestTime');
// get the user's time zone
$user =& JFactory::getUser();
$usersTZ = $user->getParam('timezone');
// output the date and time
echo JHTML::_('date', $date, JText::_('DATE_FORMAT_LC2'), $usersTZ);
Chapter 12
[ 345 ]
File System
We normally store data in the database; however, we can also store data within
the file system. Joomla! provides us with the joomla.filesystem library. This
library enables us to work easily with the file system. There are four main parts of
this library:
JPath
JFolder
JFile
JArchive
Paths
The static JPath class is integral to the library.
Pages:
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478