You should at least provide a link back to the home page, and ideally to some more relevant parent
page. Otherwise, the user may be completely lost and will proceed to the nearest back button.
It is not always desirable to have a popup spidered by a search engine. Between the navigational con-
cerns, and the fact that popups very often do not contain substantial information, it may be wiser not
to. Unless the popup has substantial information, we advise excluding the popups from the spiders’
You can obtain the page from which the user navigated to the popup by reading the
header value. This information allows you to show navigational elements only if the user
has arrived from an external web site, such as a SERP.
This method is not 100% reliable, because some firewall applications block the REFERER information.
Also, if the referring page is secured via HTTPS, the REFERER information won’t be available. In this
exercise, when there is no REFERER data, err on the safe side and display the navigational elements.
You can try out this technique by going through a short exercise.
Implementing Spiderable Popups
Add a link to your popup file in your
script, as highlighted in the following code
snippet. Note that this assumes you’re working on the code that you built in the previous chap-
ters. If you don’t have it ready, feel free to use the code download of this chapter.
// load the URL factory library
<a href=”<?php echo make_category_product_url(“Friends’ Shed”, 2, “PHP
E-Commerce Book”, 42); ?>”>
Friends’ Shed: PHP E-Commerce Book
<a href=”popup.php” target=”_blank”>Find more about Professional Search
Engine Optimization with PHP!</a>
to ensure your script loads correctly and
displays the new link, as shown in Figure 6-1. Note that this exercise assumes you have built
your simple catalog as shown in Chapter 3.
c06.qxd:c06 10:55 123