tailieunhanh - Developing Large Web Applications- P19

Developing Large Web Applications- P19: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 | loc_path . media all . When this member is set to true stylesheet keys resolve to the loc_path paths otherwise the aka_path paths are used. this- css_is_local false Build the data structure for resolving JavaScript filenames. this- js_linked_info array array aka_path . loc_path . array . . . aka_path . loc_path . . When this member is set to true JavaScript keys resolve to the loc_path paths otherwise the aka_path paths are used. this- js_is_local false You would likely define a number of other methods here for tasks specific to your web application and that apply to all parts of it. . Defining sectional page classes A sectional page class is a class derived from your sitewide page class that customizes the sitewide page class for a section of your application . NewCarsPage for a section of the site containing multiple pages related to new cars . Some methods that a sectional page class might define are get_header and get_footer to display a different header and footer for a section or get_css_linked and get_js_linked to link additional CSS and JavaScript files for just that section. In addition a sectional page class may want to register its own set of links for CSS and JavaScript files. It does this by implementing its own register_links method which calls the parent s register_links method first to let the parent add links for the entire web application then appends its own entries for CSS and JavaScript files to the css_linked_info and js_linked_info members. Working with Pages 161 Defining page-specific classes Page-specific classes are the most common pages that you ll implement. These are classes like NewCarSearchResultsPage presented earlier in Example 7-1. In page-specific classes you typically implement the following from Page s abstract interface save_data load_data get_content set_title set_meta and set_css_id. You might also implement get_css and get_js to provide small amounts of CSS and JavaScript to embed on the .