Web to py enterprise web framework - p 17

PAGE LAYOUT 145 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 {{= or )}} {{include ''}} [Here goes the header] {{if :}} {{=for _name, _active, _link in :}} | PAGE LAYOUT 145 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 head -- define the meta tags -- meta http-equiv content-type content text html charset utf-8 meta name keywords content meta name description content meta name author content -- choose a title or use the application name -- title or title -- include jQuery and other ajax functions -- include -- include a file and optional j s files -- link href URL r request c static f rel stylesheet type text css head body -- build your header -- div class header Here goes the header div -- here is the menu -- if div id menu ul -- loop over menu items -- for _name _active _link in li a href _link class active if _active else inactive _name a li pass ul div pass -- here is the flash message -- div id flash or div -- here the extending view is included -- include -- here is the footer -- div class footer created by with web2py div body html In the layout it may sometimes be necessary to display variables that are defined in the extending view. This will not be a problem as long as the variables are defined before the extend directive. This behavior can be used to extend a layout in more than one place a standard layout is extended at the point where the include directive occurs . The idea is to define view functions that generate separate portions of the page for example sidebar 146 THE VIEWS 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 1 1 2 1 2 3 4 5 6 7 maincontent and render them in different parts of the layout. The view functions are called in the layout at the points we want them rendered. For example in the following layout html body include -- must come before the two blocks below -- whatever html maincontent whatever html if sidebar in globals sidebar whatever html .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã 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.