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 99 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"

Core JTable subclasses are prefixed with JTable, non-core tables
are prefixed with Table.
When we try to save $data there are a number of actions that are performed. $data
is bound to the table, the check() method is executed, the data is stored, and the
item is checked in. If any of these methods fails then false is returned.
Therefore, if the table save method does fail, we copy the error message to the model.
This way we can determine what went wrong.
Let's take a look at a method that doesn't use a JTable to modify data. We will
implement a hit() method, which will increment the value of a foobar's hit counter.
/**
* Increments the hit counter
*
*/
function hit()
{
//
$db =& JFactory::getDBO();
$db->setQuery('UPDATE '.$db->nameQuote('#__myextension_foobar').'
.'SET '.$db->nameQuote('hits').' = '.$db-
>nameQuote('hits').' + 1 '.'WHERE id = '.$this->_id);
$db->query();
}
We could just as easily have used this as a pass-through for the TableFoobar hit()
method. We can implement many different methods in a model object.


Pages:
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6