PHP and MySQL Web Development - P39

PHP and MySQL Web Development - P39: 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. | Writing the Code for Your Class 157 var title TLA Consulting Pty Ltd Most commercial Web pages include metatags to help search engines index them. In order to be useful metatags should probably change from page to page. Again we will provide a default value var keywords TLA Consulting Three Letter Abbreviation some of my best friends are search engines The navigation buttons shown on the original page in Figure see the previous chapter should probably be kept the same from page to page to avoid confusing people but in order to change them easily we will make them an attribute too. Because there might be a variable number of buttons we will use an array and store both the text for the button and the URL it should point to. var buttons array Home Contact Services Site Map In order to provide some functionality our class will also need can start by providing accessor functions to set and get the values of the attributes we defined. These all take a form like this function SetContent newcontent this- content newcontent Because it is unlikely that we will be requesting any of these values from outside the class we have elected not to provide a matching collection of Get functions. The main purpose of this class is to display a page of HTML so we will need a have called ours Display and it is as follows function Display echo html n head n this - DisplayTitle this - DisplayKeywords this - DisplayStyles echo head n body n this - DisplayHeader this - DisplayMenu this- buttons echo this- content this - DisplayFooter echo body n html n 158 Chapter 6 Object-Oriented PHP The function includes a few simple echo statements to display HTML but mainly consists of calls to other functions in the class. As you have probably guessed from their names these other functions display parts of the page. It is not compulsory to break functions up like this. All these separate functions might simply have been combined .

Không thể tạo bản xem trước, hãy bấm tải xuống
15    20    2    02-04-2023
221    16    1    02-04-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.