Đang chuẩn bị liên kết để tải về tài liệu:
Beginning PHP and Postgre SQL E-Commerce From Novice to Professional phần 3

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Trước hết, hãy chắc chắn mục mới, bạn thêm vào để config.php được cấu hình đúng. Nếu bạn đang chạy trang web của bạn trên một cổng khác với mặc định là 80 (nói, nếu bạn đang sử dụng cổng 8080), hãy chắc chắn rằng bạn chỉ định cổng chính xác trong HTTP_SERVER_PORT không đổi. | CHAPTER 3 CREATING THE PRODUCT CATALOG PART I 105 4. Modify presentation templates departments_list.tpl like this li a selected_d href departments_list- mDepartments i .link prepare_link http raquo departments_list- mDepartments i .name a li How It Works Preparing Links First of all make sure the new entry you added to config.php is configured correctly. If you re running your web site on a different port than the default of 80 say if you re using port 8080 make sure you specify the correct port in the HTTP_SERVER_PORT constant. We also defined a constant named USE_SSL which specifies whether the site is supposed to generate HTTPS URLs. If the constant is set to no your site won t generate any HTTPS links even for the places that should normally be secured. Let s see how this works. The code you ve just added to the presentation tier is a Smarty modifier. The Smarty modifier is used as shown by the modifications you ve implemented in header.tpl and departments_list.tpl and it transforms the relative links received as parameters to absolute links. The prepare_link Smarty modifier takes as parameter the name of the protocol that should be used to generate the links if http is passed an HTTP URL will be generated if https is passed an HTTPS URL will be generated. Take the example of the link in the header a href index.php prepare_link http This link will be transformed to an absolute link by our Smarty modifier which will arrive to the client like this a href http www.example.com index.php If you wanted that particular link to be accessed only through HTTPS then you could use the Smarty modifier like this a href index.php prepare_link https This modifier would transform the link to a href https www.example.com index.php Note that if the USE_SSL constant is set to no then HTTP will be used even if the parameter is https. You can reload the web site to ensure that nothing s broken. Note In case you aren t using the hatshop alias as explained in Chapter 2 you ll need to