-
Book Overview & Buying
-
Table Of Contents
Mastering Joomla! 1.5 Extension and Framework Development Second Edition
By :
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 native file system. There are four main classes included in this library:
JPath
JFolder
JFile
JArchive
The static JPath class is integral to the library. Before we jump in, we must import the relevant library in order to use the JPath class:
jimport('joomla.filesystem.path');The first three methods we will discuss are:
clean()
check()
find()
The clean() method is used to tidy up a path by removing any unnecessary directory separators and ensuring that all remaining directory separators are of the correct type for the current system. We use the clean() method as follows:
$path = JPATH_BASE.'\foo//bar\\baz'; $cleanPath = JPath::clean($path);
The following examples demonstrate the values associated with $path and $cleanPath respectively (assuming JPATH_BASE is equal to /var/www/html...
Change the font size
Change margin width
Change background colour