PHP 5/MySQL Programming- P53

PHP 5/MySQL Programming- P53:computer programming has often been seen as a difficult and arcane skill. Programming languages are difficult and complicated, out of the typical person’s reach. However, the advent of the World Wide Web has changed that to some extent. It’s reasonably easy to build and post a Web page for the entire world to see. The language of the Web is reasonably simple, and numerous applications are available to assist in the preparation of static pages | 238 PHP 5 MySQL Programming for the Absolute Beginner include s new SuperHTML Creating Lists s- buildTop myArray array alpha beta gamma delta s- h3 build an ordered list s- buildList myArray ol s- h3 unordered lists are the default s- buildList array alpha beta gamma delta s- h3 specify list type s- buildList myArray ol type a s- buildBottom print s- getPage Building a Basic List I started the code by creating an array called cleverly enough myArray. The buildList method requires two parameters an array and a list type. Then I invoke the function s- buildList myArray ol The SuperHTML object responds by adding the following code to its internal representation of the page ol li alpha li li beta li li gamma li li delta li ol As you can see each array item is enclosed in li li tags and the entire array is encased in an ol ol set with appropriate indentation. You ll be much more willing to use arrays when you have an easy tool like this to display them. 239 Building an Ad Hoc List Of course you don t always want an ordered list. The next call to the buildList method is different from the first version in two ways s- buildList array alpha beta gamma delta First I built this one on-the-fly rather than using a predefined array. This is useful when you want to build a list quickly but don t already have an array. Just put the list values in an ad hoc array before sending the array to the buildList method. Second this call is different because of the lack of a list type. If I don t indicate what type of list I want SuperHTML is smart enough to guess and put a legal value in for me. This behavior is a good example of a principle called polymorphism where an object can act differently in different situations. Of course the formal definition is a little more profound than that but this is good enough for now. You can probably guess that the default list type is unordered. Building More-Specialized Lists The buildList method has one more trick up its .

Không thể tạo bản xem trước, hãy bấm tải xuống
13    25    2    31-03-2023
37    36    2    31-03-2023
182    10    3    31-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.