-
Book Overview & Buying
-
Table Of Contents
Mastering Joomla! 1.5 Extension and Framework Development Second Edition
Joomla! makes extensive use of the database and provides some powerful tools for accessing, retrieving, and updating the database. At initialization, Joomla! creates a connection to the database by instantiating a global JDatabase object. This database connection can be accessed within your extension by assigning an object reference to a local variable using the static JFactory class method getDBO(), as is shown in the following:
$db =& JFactory::getDBO();
Note that we must use =& which assigns a reference to the existing database object to the variable; using = will create a copy of the existing database object.
Two subclasses, JDatabaseMySQL and JDatabaseMySQLi, extend the JDatabase class depending on the exact database engine installed. The JDatabase class has over fifty methods although, in all likelihood, you will only use a small subset; which methods you use will largely be a matter of personal preference and the functionality required. Some are easier...
Change the font size
Change margin width
Change background colour