/[cvs]/nfo/php/libs/com.newsblob.phphtmllib/examples/MyLayoutPage.inc
ViewVC logotype

Annotation of /nfo/php/libs/com.newsblob.phphtmllib/examples/MyLayoutPage.inc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (hide annotations)
Sat Sep 20 00:20:55 2003 UTC (20 years, 10 months ago) by jonen
Branch: MAIN
Changes since 1.2: +0 -0 lines
+ updated whole phphtmllib to v2.3.0

1 jonen 1.1 <?php
2     /**
3     * This is the example PageWidget child
4     * for the examples pages.
5     *
6     *
7     * $Id: MyLayoutPage.inc,v 1.3 2002/10/03 18:39:25 hemna Exp $
8     *
9     * @author Walter A. Boring IV <waboring@buildabetterweb.com>
10     * @package phpHtmlLib
11     * @subpackage examples
12     * @version 2.0.0
13     *
14     */
15    
16    
17    
18     /**
19     * This is an example Child of the PageWidget
20     * class to show how to build a simple application
21     * or system wide layout simple to manage and
22     * maintain
23     *
24     * @author Walter A. Boring IV <waboring@buildabetterweb.com>
25     * @package phpHtmlLib
26     * @subpackage examples
27     * @version 2.0.0
28     */
29     class MyLayoutPage extends PageWidget {
30    
31    
32     /**
33     * This is the constructor.
34     *
35     * @param string - $title - the title for the page and the
36     * titlebar object.
37     * @param - string - The render type (HTML, XHTML, etc. )
38     *
39     */
40     function MyLayoutPage($title, $render_type = HTML) {
41    
42     $this->PageWidget( $title, $render_type );
43    
44     //add some css links
45     //assuming that phphtmllib is installed in the doc root
46     $this->add_css_link("/phphtmllib/examples/css/main.css");
47     $this->add_css_link("/phphtmllib/css/fonts.css");
48     $this->add_css_link("/phphtmllib/css/colors.css");
49    
50     //add the phphtmllib widget css
51     $this->add_css_link( "/phphtmllib/css/bluetheme.php" );
52     }
53    
54     /**
55     * This builds the main content for the
56     * page.
57     *
58     */
59     function body_content() {
60    
61     //add the header area
62     $this->add( html_comment( "HEADER BLOCK BEGIN") );
63     $this->add( $this->header_block() );
64     $this->add( html_comment( "HEADER BLOCK END") );
65    
66     //add it to the page
67     //build the outer wrapper div
68     //that everything will live under
69     $wrapper_div = html_div();
70     $wrapper_div->set_id( "phphtmllib" );
71    
72     //add the main body
73     $wrapper_div->add( html_comment( "MAIN BLOCK BEGIN") );
74     $wrapper_div->add( $this->main_block() );
75     $wrapper_div->add( html_comment( "MAIN BLOCK END") );
76    
77     $this->add( $wrapper_div );
78    
79     //add the footer area.
80     $this->add( html_comment( "FOOTER BLOCK BEGIN") );
81     $this->add( $this->footer_block() );
82     $this->add( html_comment( "FOOTER BLOCK END") );
83    
84     }
85    
86    
87     /**
88     * This function is responsible for building
89     * the header block that lives at the top
90     * of every page.
91     *
92     * @return HTMLtag object.
93     */
94     function header_block() {
95     $header = html_div("pageheader");
96    
97     $header->add( "HEADER BLOCK AREA" );
98     return $header;
99     }
100    
101    
102     /**
103     * We override this method to automatically
104     * break up the main block into a
105     * left block and a right block
106     *
107     * @param TABLEtag object.
108     */
109     function main_block() {
110    
111     $main = html_div();
112     $main->set_id("maincontent");
113    
114     $table = html_table("100%",0);
115     $left_div = html_div("leftblock", $this->left_block() );
116    
117     $table->add_row( html_td("leftblock", "", $left_div ),
118     html_td("divider", "", "&nbsp;"),
119     html_td("rightblock", "", $this->content_block() ));
120     $main->add( $table );
121    
122     return $main;
123     }
124    
125    
126     /**
127     * this function returns the contents
128     * of the left block. It is already wrapped
129     * in a TD
130     *
131     * @return HTMLTag object
132     */
133     function left_block() {
134     $div = html_div();
135     $div->set_style("padding-left: 6px;");
136    
137     $div->add( "LEFT BLOCK" );
138     return $div;
139     }
140    
141    
142    
143     /**
144     * this function returns the contents
145     * of the right block. It is already wrapped
146     * in a TD
147     *
148     * @return HTMLTag object
149     */
150     function content_block() {
151     $container = container( "CONTENT BLOCK", html_br(2),
152     html_a($_SERVER["PHP_SELF"]."?debug=1",
153     "Show Debug source"),
154     html_br(10));
155     return $container;
156     }
157    
158    
159     /**
160     * This function is responsible for building
161     * the footer block for every page.
162     *
163     * @return HTMLtag object.
164     */
165     function footer_block() {
166    
167     $footer_div = html_div();
168     $footer_div->set_tag_attribute("id", "footerblock");
169     $footer_div->add("FOOTER BLOCK");
170    
171     return $footer_div;
172     }
173     }
174     ?>

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed