Prev | Current Page 181 | Next

Emilian Balanescu and Cristian Darie

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

name}

CHAPTER 4 ?–  CREATING THE PRODUCT CATALOG: PART 1 107
Creating the Link Factory
In a well-constructed web site, all the links must have a consistent format. For example, in
PHP, you read query string parameters by name rather than ordinal, so the following two links
would normally have the same output:
??? http://localhost/index.php?DepartmentId=3&CategoryId=5
??? http://localhost/index.php?CategoryId=5&DepartmentId=3
In many cases, the case of parts of an URL can be changed without affecting the output. To
have all the URLs in our web site follow a consistent style, we??™ll create a class that creates links.
This class will prove to be very useful in the long term. In Chapter 7, we??™ll update the URLs
in our web site, so that they will be more friendly to search engines and human visitors browsing
your site. Having a central place that generates links will make this feature easy to implement.
Also, at some point in the development process, you??™ll want certain pages of your site to
be accessible only through secured HTTPS connections to ensure the confidentiality of the
data passed from the client to the server and back. Such sensitive pages include user login forms,
pages where the user enters credit card data, and so on. We don??™t get into much detail here.
However, what you do need to know is that pages accessed through HTTPS occupy much of
a server??™s resources, and we only want to use a secure connection when visiting secure pages.


Pages:
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193