PHP and MySQL Web Development - P40

PHP and MySQL Web Development - P40: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | 162 Chapter 6 Object-Oriented PHP 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 php while inside the functions. Two other operations are defined in this 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 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. 2. Creates an instance of the class instance is called homepage. 3. Calls the operation SetContent within the object homepage and passes 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 browser. Listing This Home Page Uses the Page Class to Do Most of the Work Involved in Generating the Page php require homepage new Page homepage - SetContent p Welcome to the home of TLA Consulting. Please take some time to get to know us. p

Không thể tạo bản xem trước, hãy bấm tải xuống
42    27    1    24-03-2023
33    35    1    24-03-2023
23    272    1    24-03-2023
38    25    2    24-03-2023
279    20    1    24-03-2023
Đã 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.