TAILIEUCHUNG - OBJECT-ORIENTED PHP Concepts, Techniques, and Code- P8

OBJECT-ORIENTED PHP Concepts, Techniques, and Code- P8:A number of years ago, before I started using PHP, I created dynamic web pages using C. This really wasn’t too different from some of the other options available at the time, though it seems almost unthinkable now. Creating a dynamic page meant outputting HTML from your script and recompiling that script if any changes needed to be made. | The remaining four variables are simply text strings that label the controls used in the navigator and they can be changed as the user sees fit text for navigation private strfirst lt private strnext Next private strprevious Prev private strlast gt for error reporting private errorstring The use of variables for the navigation text means that a client programmer can configure these values the look of the navigator is not fixed and can be adjusted to accommodate different visual layouts. The final data member is a string variable used for error reporting. The Constructor Now let s see how the class is constructed. The constructor accepts six arguments two of which have default values. Here is the constructor declaration public function construct pagename totalrecords recordsperpage recordoffset maxpagesshown 4 params Four of the parameters to the constructor are simply copied into their class equivalents and all have been discussed in the previous section on the data members. this- pagename pagename this- recordsperpage recordsperpage this- maxpagesshown maxpagesshown already urlencoded this- params params Note that params the variable that contains any additional parameters as a name value pair is not URL-encoded within the class. If it is used it will need to be URL-encoded before it is sent. The constructor finishes with calls to a number of private class methods check recordoffset a multiple of recordsperpage this- checkRecordOffset recordoffset recordsperpage or die this- errorstring this- setTotalPages totalrecords recordsperpage this- calculateCurrentPage recordoffset recordsperpage this- createInactiveSpans this- calculateCurrentStartPage this- calculateCurrentEndPage Let s look at each of these method calls in turn. Building the PogeNovigeior Gloss 51 Ain t Misbehavin If you want your navigator to behave properly you can check some of the values passed to the constructor that s exactly what the checkRecordOffset method does. It terminates construction of

TỪ KHÓA LIÊN QUAN
TÀI LIỆU LIÊN QUAN
19    16    0
182    13    0
138    6    0
3    7    0
142    12    0