Prev | Current Page 342 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"

You will do this in the next exercise; until then, make sure you understand
how the search box works.
The search_box.tpl template contains the HTML layout of the box??”no mysteries here. On the other hand, the
presentation object that supports this template deserves some attention. The SearchBox class in search_box.php
has two functions:
CHAPTER 8 ?–  SEARCHING THE CATALOG 240
??? When the visitor types a search string and submits the form, the search box, via status code 302, redirects
the request to a URL that can be bookmarked by the visitor, such as http://localhost/tshirtshop/
search-results/find-beautiful-flower/all-words-off/. Unless such a mechanism is implemented,
the search results would be displayed on the page the visitor was seeing when he or she performed
the search.
??? If the page that is currently loaded is a search results page, or a product details page that was reached from
a search results page, the search box is filled with the keywords that were searched by the visitor.
The location to which the request is redirected when a search is performed is calculated using the
Link::ToSearchResults() method. Note that a 302 redirect is used. This is the status code that specifies
a temporary page relocation, although in this case, the status code used doesn??™t really matter, because search
engines wouldn??™t submit the form anyway.


Pages:
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354
Ustawy Nr8 świnoujście meble biurowe download poker online