Prev | Current Page 229 | Next

Rob Allen, Nick Lo, and Steven Brown

"Zend Framework in Action"

Now that we have either generated a result set or failed validation, we need to display
this information to the user in the view.
Displaying the search results in the view
The view has two responsibilities: display any failure messages to the user and to display the search results. To
display the error messages, we simply iterate over the list and echo within a list. This is shown in Listing 8.12.
Listing 8.12: Displaying error messages from Zend_Filter_Input
messages) : ?>
A
There was a problem:

    messages['q'] as $msg) : ?> B




A id is used to CSS styling
B Iterate over all messages for ???q??™
This is very straightforward and the only thing to note is that we only iterate over the ???q??™ array within
messages as we know that there is only one form field in this form. For a more complicated search form,
we??™d have to iterate over all the form fields. The second half of the view script displays the search results. The
fields we have available are limited to those we set up in Places_Search_Lucene_Document back in listing 8.2
and this is shown in listing 8.13.
Listing 8.12: Displaying error messages from Zend_Filter_Input

You searched for escape($this->q); ?>.


Pages:
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241

wynajem mieszkań Kraków kobiecy nowoczesne meble podłogi drewniane roll-up