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

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"

In this example, if name is not set, we set it to the default value
of 'unknown'.
JRequest::setVar('name', JRequest::getVar('name', 'unknown'));
Some other handy methods in JRequest are getInt(), getFloat(), getBool(),
getWord(), getCmd(), and getString(). If we use these methods, we guarantee
that the returned value is of a specific type.
It is important to familiarize yourself with the JRequest methods
described above because they are used extensively in Joomla!. In
addition, we will use them repeatedly in the code examples presented
throughout this book.
There is far more we can achieve using these methods, including preprocessing of
data. A more complete explanation is available in Chapter 11.
The Factory
Before we jump into the Joomla! factory, we need to take a quick moment to
contemplate the patterns that occur in code. Referred to as Design Patterns,
commonly occurring patterns within code have been studied for some time and
much has been learned from them.
One of the most common patterns with which we will be familiar is the iterator
pattern.


Pages:
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52