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

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"

php.
All model classes extend the abstract JModel class. This example shows a very basic
implementation of the MyextensionModelFoobar class.
// ensure a valid entry point
defined(_JEXEC) or die('Restricted Access');
// import the JModel class
jimport('joomla.application.component.model');
/**
* Foobar Model
*/
class MyextensionModelFoobar extends JModel
{ }
I warned you it was basic! Actually, it is so basic it is useless. Before we continue,
note that we had to import the joomla.application.component.model library.
This guarantees that the JModel class is present.
We use special methods prefixed with the word get to retrieve data from models.
Most models only have one of these methods. The next step is to build a get method.
Our example is dealing with the entity foobar, so we'll create a get method,
getFoobar(). To ensure that we get the right foobar we need to determine which
foobar we are looking for.
Chapter 4
[ 71 ]
We will assume that the ID of the foobar in which we are interested is either the first
element in the array cid or the value of id.


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