TAILIEUCHUNG - Phát triển web với PHP và MySQL - p 20

Object-Oriented PHP CHAPTER 6 165 LISTING } Continued 6 OBJECT-ORIENTED PHP function DisplayFooter() { ? © TLA Consulting Pty Ltd. Please see our legal information page When reading it, note that DisplayStyles(), DisplayHeader(), and DisplayFooter() need to display a large block of static HTML, with no PHP processing. Therefore, we have simply used an end PHP tag (?), typed our HTML, and then re-entered PHP with an open PHP tag ( | Object-Oriented PHP 165 Chapter 6 Listing Continued function DisplayFooterO table width 100 bgcolor black cellpadding 12 border 0 tr td p class foot copy TLA Consulting Pty Ltd. p p class foot Please see our a href legal information page a p td tr table 6 Object-Oriented PHP When reading it note that DisplayStyles DisplayHeader and DisplayFooterO need to display a large block of static HTML with no PHP processing. Therefore we have simply used an end PHP tag typed our HTML and then re-entered PHP with an open PHP tag while inside the functions. Two other operations are defined in this class. The operation DisplayButton outputs a single menu button. If the button is to point to the page we are on we are displaying an inactive button instead which looks slightly different and does not link anywhere. This keeps the page layout consistent and provides visitors with a visual location. The operation IsURLCurrentPage determines if the URL for a button points to the current page. Lots of techniques can be used to discover this. We have used the string function strpos to see if the URL given is contained in one of the server set variables. The statement strpos GLOBALS SCRIPT_NAME url will either return a number if the string in url is inside the global variable SCRIPT_NAME or false if it is not. To use this page class we need to include in a script and call Display . The code in Listing will create TLA Consulting s home page and give output very similar to that we previously generated in Figure . The code in Listing does the following 1. Uses require to include the contents of which contains the definition of the class Page. 166 Using PHP Part I 2. Creates an instance of the class Page. The instance is called homepage. 3. Calls the operation SetContent within the object homepage and pass some text and HTML tags to appear in the page. 4. Calls the operation Display within the object homepage to cause the page to be displayed in the visitor s

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.