tailieunhanh - Developing Large Web Applications- P20

Developing Large Web Applications- P20:This book presents a number of techniques for applying established practices of good software engineering to web development—that is, development primarily using the disparate technologies of HTML, CSS, JavaScript, and server-side scripting languages. Whereas there are many books on how to use languages, how to use libraries, and how to approach software engineering, this is the first book to codify many of the techniques it presents. These techniques will make the components of your own web applications more reusable, maintainable, and reliable | The content for this module consists of a single image along with text for the caption and the attribution. attr if empty this- picture attr attr EOD cite courtesy of this- picture attr cite EOD if empty this- picture img_l img else img EOD img src this- picture img_l alt this- picture text Width 600 EOD return EOD div id picvwr class this- type div class vwrimg img div attr div class vwrcap this- picture text div div EOD _ Example 7-7 presents the JavaScript that implements behaviors for the Picture Slider module. In a manner consistent with what we discussed for large-scale JavaScript in Chapter 5 the module has a JavaScript object that neatly encapsulates the functionality that the component requires and the object is named PictureSlider to reflect the module s name. In Example 7-6 the get_js_linked method of PictureSlider specifies that this object is defined in the file identified by the key . The JavaScript for the module needs two YUI libraries which you can download from http developer . yui to support it. Therefore get_js_linked specifies keys for these files before . Working with Modules 171 Example 7-7. PictureSlider JavaScript object for the slideshow Pictureslider function Set up references to the elements needed for the slider and viewer. picsld if table 0 o null if btnl img o o null btnr img o o null picvwr You pass values for the following parameters to the module s constructor in PHP. The module s get_js method in PHP dynamically generates the JavaScript to set these members from those values. o o o .