SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 83 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"

To deal with this we can provide the reorder() method with a parameter
to restrict the records. Imagine that our table also has a field named group; in this
Chapter 3
[ 61 ]
example, we reorder the records in group 1:
$db =& $table::getDBO();
$where = $db->nameQuote('group').' = 1';
$table->reorder($where);
Notice that we get the database object from $table not JFactory; this ensures that
we are using the correct database driver for the database server that $table is using.
Although this is not a major issue, as Joomla! begins to support other database
drivers, there may be occasions where the database driver being used by a table is
different from the global database driver.
You may remember earlier in this chapter we used the getNextOrder() method.
This method tells us what the next available position is in the order. As with
reorder(), we have the option of specifying groupings. Imagine that our table also
has a field named group; in this example, we get the next available position in the
records in group 1:
$db =& $table::getDBO();
$where = $db->nameQuote('group').


Pages:
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95