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

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"

$db->nameQuote('#__some_table').
' WHERE '.$db->nameQuote('category').' = '.$category.
' AND '.$db->nameQuote('published').' = 1';
}
}
Chapter 5
[ 123 ]
We split the getItems() method into two; this makes the code more readable and
aids the logical structure of the class. Notice that the getItems() method returns a
reference, which reduces memory overheads when using the method.
We also need to pass a JParameter object to the getItems() method, most likely
the module parameters, $params. We then use a parameter named 'category' to
determine which records to get from the fictitious database table, #__some_table.
It is common practice to pass the $params object to module helper class methods. If a
method is only using one parameter from $params, it is still a good idea to pass the
entire object because it will make the addition of any extra parameters easier.
We could have specified $instance as static, only executing the query if it hadn't
been executed already. This would only make sense if there were a possibility that
the method would be executed more than once.


Pages:
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6