Prev | Current Page 347 | Next

Emilian Balanescu and Cristian Darie

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

..
/* 404 redirect if the page number is greater than
the total number of pages */
if ($this->mPage > $this->mrTotalPages && !empty($this->mrTotalPages))
{
// Clean output buffer
ob_clean();
...
6. Add the following lines at the beginning of presentation/templates/products_list.tpl:
{* products_list.tpl *}
{load_presentation_object filename="products_list" assign="obj"}
{if $obj->mSearchDescription != ""}

{$obj->mSearchDescription}


{/if}
7. Open .htaccess, and type the following RewriteRule lines, which redirect the search results pages:
# Redirect department pages
RewriteRule ^.*-d([0-9]+)/page-([0-9]+)/?$ index.php?DepartmentId=$1&Page=$2 [L]
RewriteRule ^.*-d([0-9]+)/?$ index.php?DepartmentId=$1 [L]
# Redirect search results
RewriteRule ^search-results/find-(.*)/all-words-(on|off)/page-([0-9]+)/?$
index.php?SearchResults&SearchString=$1&AllWords=$2&Page=$3 [L]
RewriteRule ^search-results/find-?(.*)/all-words-(on|off)/?$
index.php?SearchResults&SearchString=$1&AllWords=$2&Page=1 [L]
# Redirect subpages of the home page
RewriteRule ^page-([0-9]+)/?$ index.php?Page=$1 [L]
CHAPTER 8 ?–  SEARCHING THE CATALOG 245
8. Modify the presentation/store_front.php file to load the search_results componentized template
when a search is performed by adding the highlighted lines of code in the init() method:
...


Pages:
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359
Books kratki ściekowe internetowe kursy angielskiego Pozycjonowanie świadectwo energetyczne