Thread: [phpwebapp-commits] CVS: documentation/templates/tutorial transitions.html,1.6,1.7 templates.html,1.
Brought to you by:
dashohoxha
From: Dashamir H. <das...@us...> - 2004-07-29 14:43:46
|
Update of /cvsroot/phpwebapp/documentation/templates/tutorial In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18452/templates/tutorial Modified Files: transitions.html templates.html intro.html Log Message: Index: transitions.html =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/tutorial/transitions.html,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** transitions.html 21 Jul 2004 17:15:31 -0000 1.6 --- transitions.html 29 Jul 2004 14:43:36 -0000 1.7 *************** *** 67,74 **** <em>JavaScript</em> function, and this function makes the transition by calling <strong>GoTo()</strong>. So, the application ! has a chance to make any error checkings, input data validations etc. before making the transition to the other page.</p> ! <p><a href="javascript:codeReview('{{APP1_PATH}}page1.html','14,40,41')"> See the code</a> of the first page and notice how the <strong>GoTo()</strong> is used. --- 67,74 ---- <em>JavaScript</em> function, and this function makes the transition by calling <strong>GoTo()</strong>. So, the application ! has a chance to make any error checking, input data validations etc. before making the transition to the other page.</p> ! <p><a href="javascript:codeReview('{{APP1_PATH}}page1.html','18,57,58')"> See the code</a> of the first page and notice how the <strong>GoTo()</strong> is used. *************** *** 105,109 **** <p>See an ! <a href="javascript:codeReview('{{APP1_PATH}}page2.html','14,15','9-16')"> example</a> of linking to external pages.</p> --- 105,109 ---- <p>See an ! <a href="javascript:codeReview('{{APP1_PATH}}page2.html','23,24','15-32')"> example</a> of linking to external pages.</p> *************** *** 129,137 **** config/ -- configuration files for the application const.Paths.php -- constants of paths used in the application ! const.Options.php -- constants that change the behaviour of the app const.Debug.php -- constants that are used for debugging the app ! index.php -- standart framework file ! webapp.php -- standart framework file </pre> <br /> --- 129,137 ---- config/ -- configuration files for the application const.Paths.php -- constants of paths used in the application ! const.Options.php -- constants that change the behavior of the app const.Debug.php -- constants that are used for debugging the app ! index.php -- standard framework file ! webapp.php -- standard framework file </pre> <br /> *************** *** 163,169 **** them are optional. These constants are: <strong>WEBAPP_PATH</strong> and <strong>TPL_PATH</strong> in ! <a href="javascript:codeReview('{{APP1_PATH}}config/const.Paths.php','3,4')">const.Paths.php</a>, and <strong>FIRSTPAGE</strong> in ! <a href="javascript:codeReview('{{APP1_PATH}}config/const.Options.php', '9-13', '1-21')">const.Options.php</a> </p> --- 163,169 ---- them are optional. These constants are: <strong>WEBAPP_PATH</strong> and <strong>TPL_PATH</strong> in ! <a href="javascript:codeReview('{{APP1_PATH}}config/const.Paths.php','5,6')">const.Paths.php</a>, and <strong>FIRSTPAGE</strong> in ! <a href="javascript:codeReview('{{APP1_PATH}}config/const.Options.php','30-34','22-42')">const.Options.php</a> </p> *************** *** 173,179 **** <a name="exercises"></a> ! <h3>Exerxises</h3> ! <p>To be able to try the exercises you have to instal the framework and the sample applications in your computer or somewhere where you can make changes.</p> --- 173,179 ---- <a name="exercises"></a> ! <h3>Exercises</h3> ! <p>To be able to try the exercises you have to install the framework and the sample applications in your computer or somewhere where you can make changes.</p> *************** *** 184,188 **** <p>In this exercise you will create another application which is ! identic with <strong>app1</strong> but has a different name, <strong>app1_test</strong>. Follow these steps:</p> --- 184,188 ---- <p>In this exercise you will create another application which is ! the same as <strong>app1</strong> but has a different name, <strong>app1_test</strong>. Follow these steps:</p> *************** *** 191,195 **** <kbd>$ cp -R app1 app1_test</kbd></li> ! <li>That was all, open the application <em>/app1_test/</em> in browser to test it. It should work.</li> </ol> --- 191,195 ---- <kbd>$ cp -R app1 app1_test</kbd></li> ! <li>That was all, open the application <em>app1_test/</em> in browser to test it. It should work.</li> </ol> *************** *** 206,214 **** <kbd>$ mkdir test <br /> $ mv app1_test test</kbd></li> ! <li>Edit the file <em>test/app1_test/config/<a href="javascript:codeReview('{{APP1_PATH}}config/const.Paths.php','3')">const.Paths.php</a></em> so that the constant <strong>WEBAPP_PATH</strong> is set to <strong>UP_PATH."../web_app/"</strong>.</li> ! <li>Open the application <em>/test/app1_test/</em> in browser to test it; it should work.</li> </ol> --- 206,214 ---- <kbd>$ mkdir test <br /> $ mv app1_test test</kbd></li> ! <li>Edit the file <em>test/app1_test/config/<a href="javascript:codeReview('{{APP1_PATH}}config/const.Paths.php','5')">const.Paths.php</a></em> so that the constant <strong>WEBAPP_PATH</strong> is set to <strong>UP_PATH."../web_app/"</strong>.</li> ! <li>Open the application <em>test/app1_test/</em> in browser to test it; it should work.</li> </ol> *************** *** 222,229 **** <p>In this example it is set as a relative path, but it can be set ! as an absolute path as well, e.g. <em>/var/www/html/web_app/</em> (or ! <em>c:/www/html/web_app/</em> for Windows). In this case you don't have to ! wory about changing it when moving an application to another ! location.</p> <a name="exercise_3"></a> --- 222,228 ---- <p>In this example it is set as a relative path, but it can be set ! as an absolute path as well, e.g. <em>/var/www/html/web_app/</em>. ! In this case you don't have to worry about changing it when moving ! an application to another location.</p> <a name="exercise_3"></a> *************** *** 233,237 **** <ol> <li>Edit the file ! <a href="javascript:codeReview('{{APP1_PATH}}config/const.Debug.php','6-10')"> <em>config/const.Debug.php</em></a> and set the constant <strong>DEBUG_GOTO</strong> to <strong>true</strong>.</li> --- 232,236 ---- <ol> <li>Edit the file ! <a href="javascript:codeReview('{{APP1_PATH}}config/const.Debug.php','27-31')"> <em>config/const.Debug.php</em></a> and set the constant <strong>DEBUG_GOTO</strong> to <strong>true</strong>.</li> *************** *** 263,267 **** <ol> <li>Open the file <em>config/<a href= ! "javascript:codeReview('{{APP1_PATH}}config/const.Options.php','9-13')">const.Options.php</a></em> and set the <strong>FIRSTPAGE</strong> variable to <strong>page2.html</strong>.</li> --- 262,266 ---- <ol> <li>Open the file <em>config/<a href= ! "javascript:codeReview('{{APP1_PATH}}config/const.Options.php','30-34')">const.Options.php</a></em> and set the <strong>FIRSTPAGE</strong> variable to <strong>page2.html</strong>.</li> *************** *** 285,289 **** <li>Open the file <em>config/<a href= ! "javascript:codeReview('{{APP1_PATH}}config/const.Paths.php','4')">const.Paths.php</a></em> and set the constant <strong>TPL_PATH</strong> to <strong>APP_PATH."pages/"</strong>.</li> --- 284,288 ---- <li>Open the file <em>config/<a href= ! "javascript:codeReview('{{APP1_PATH}}config/const.Paths.php','6')">const.Paths.php</a></em> and set the constant <strong>TPL_PATH</strong> to <strong>APP_PATH."pages/"</strong>.</li> *************** *** 295,302 **** look for the pages (in the phpWebApp jargon pages are called <em>templates</em> because they may contain <em>variables</em> and ! other <em>extra tags</em> that are reckognized by the framework). When you write <strong>GoTo('page1.html')</strong>, the framework looks for <em>page1.html</em> in the <strong>TPL_PATH</strong>. The constant ! <strong>APP_PATH</strong> is a predefined constat and it contains the path of the application itself.</p> --- 294,301 ---- look for the pages (in the phpWebApp jargon pages are called <em>templates</em> because they may contain <em>variables</em> and ! other <em>extra tags</em> that are processed by the framework). When you write <strong>GoTo('page1.html')</strong>, the framework looks for <em>page1.html</em> in the <strong>TPL_PATH</strong>. The constant ! <strong>APP_PATH</strong> is a predefined constant and it contains the path of the application itself.</p> *************** *** 309,313 **** <p>Another kind of constants used in the framework, the URL constants, represent paths in the application starting from the DocumentRoot (the ! part of the URL comming after the server name and before the file name). By convention, they end with an <strong>_URL</strong> and their value ends with a slash <strong>/</strong>. E.g. IMG_URL, JS_URL, etc.</p> --- 308,312 ---- <p>Another kind of constants used in the framework, the URL constants, represent paths in the application starting from the DocumentRoot (the ! part of the URL coming after the server name and before the file name). By convention, they end with an <strong>_URL</strong> and their value ends with a slash <strong>/</strong>. E.g. IMG_URL, JS_URL, etc.</p> Index: templates.html =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/tutorial/templates.html,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** templates.html 21 Jul 2004 17:15:31 -0000 1.7 --- templates.html 29 Jul 2004 14:43:36 -0000 1.8 *************** *** 88,101 **** <p>See this ! <a href="javascript:codeReview('{{APP2_PATH}}templates/page3/page3.html','4,7,9,11')"> ! example</a>. The <strong>{{#TPL_URL}}</strong> variable in line 4 contains the URL of the folder <em>templates</em>, which in this case is <em>{{APP2_URL}}templates/</em>. The <strong>{{#TPL_PATH}}</strong> variable in ! lines 7 and 11 contains the path in the server of the folder templates, e.g. <em>/var/www/html{{APP2_URL}}templates/</em>. Both of them are declared in the file ! <a href="javascript:codeReview('{{APP2_PATH}}config/const.Paths.php','4,5')"> <em>config/const.Paths.php</em></a>. The variable <strong>{{#./}}</strong> ! in line 9 is a special framework variable that always contains the path of the current folder, i.e. the folder of the current file.</p> --- 88,101 ---- <p>See this ! <a href="javascript:codeReview('{{APP2_PATH}}templates/page3/page3.html','8,11,13,15')"> ! example</a>. The <strong>{{#TPL_URL}}</strong> variable in line 8 contains the URL of the folder <em>templates</em>, which in this case is <em>{{APP2_URL}}templates/</em>. The <strong>{{#TPL_PATH}}</strong> variable in ! lines 11 and 15 contains the path in the server of the folder templates, e.g. <em>/var/www/html{{APP2_URL}}templates/</em>. Both of them are declared in the file ! <a href="javascript:codeReview('{{APP2_PATH}}config/const.Paths.php','6,7')"> <em>config/const.Paths.php</em></a>. The variable <strong>{{#./}}</strong> ! in line 13 is a special framework variable that always contains the path of the current folder, i.e. the folder of the current file.</p> *************** *** 103,114 **** <a name="include"></a> ! <h4>2 - The &lt;Include&gt; tag</h4> <p>The templates may also contain some extra tags, which are not ! HTML tags. These tags are reckognised and processed by the ! framework. One of them is the &lt;Include&gt; tag, which is used to include another template inside the current template:</p> <pre> ! &lt;Include src="file_to_be_included" /&gt; </pre> --- 103,114 ---- <a name="include"></a> ! <h4>2 - The &lt;include&gt; tag</h4> <p>The templates may also contain some extra tags, which are not ! HTML tags. These tags are recognized and processed by the ! framework. One of them is the &lt;include&gt; tag, which is used to include another template inside the current template:</p> <pre> ! &lt;include src="file_to_be_included" /&gt; </pre> *************** *** 116,122 **** subtemplates, which results in a better structured application, provides modularity (the graphical designer can work with smaller ! pieces of code), and reusability (templates are easier to be reused in other pages or other applications). See how it is used in this ! <a href="javascript:codeReview('{{APP2_PATH}}templates/page3/page3.html','7,9,11')"> example</a>.</p> --- 116,122 ---- subtemplates, which results in a better structured application, provides modularity (the graphical designer can work with smaller ! pieces of code), and re-usability (templates are easier to be reused in other pages or other applications). See how it is used in this ! <a href="javascript:codeReview('{{APP2_PATH}}templates/page3/page3.html','11,13,15')"> example</a>.</p> *************** *** 127,136 **** <p>The templates may contain some special comments as well:</p> <pre> ! &lt;!--# Framework comments #--&gt; </pre> <p>These comments are like HTML comments but they have a diesis ! <strong>#</strong> at the opening and closing marks. These comments ! are not processed (are skiped, ignored) by the framework and are not displayed in the HTML page that is generated. <a href="javascript:codeReview('{{APP2_PATH}}templates/header.html','1-3')"> --- 127,136 ---- <p>The templates may contain some special comments as well:</p> <pre> ! &lt;!--# Framework comments --&gt; </pre> <p>These comments are like HTML comments but they have a diesis ! <strong>#</strong> at the opening mark. These comments ! are not processed (are skipped, ignored) by the framework and are not displayed in the HTML page that is generated. <a href="javascript:codeReview('{{APP2_PATH}}templates/header.html','1-3')"> *************** *** 143,153 **** <p>If a certain template has some javascript code or some special styles of its own, then it is better to include them at the ! begining of the template (instead of including them globally, at the &lt;Head&gt; of the page). This makes the template more ! independant from the other parts of the page and thus easier to use it again into another page. They are included like this:</p> <pre> ! &lt;script language="javascript" src="file.js"&gt;&lt;/script&gt; ! &lt;link rel="stylesheet" type="text/css" href="file.css"&gt; </pre> --- 143,153 ---- <p>If a certain template has some javascript code or some special styles of its own, then it is better to include them at the ! beginning of the template (instead of including them globally, at the &lt;Head&gt; of the page). This makes the template more ! independent from the other parts of the page and thus easier to use it again into another page. They are included like this:</p> <pre> ! &lt;script type="text/javascript" language="javascript" src="file.js"&gt;&lt;/script&gt; ! &lt;link type="text/css" rel="stylesheet" href="file.css"&gt; </pre> *************** *** 157,161 **** example2</a>. ! <p>The inclusion is much better than writting the JS and CSS code in the template because it separates the HTML code from the JS and CSS codes. It also is more efficient (has a better performance) because --- 157,161 ---- example2</a>. ! <p>The inclusion is much better than writing the JS and CSS code in the template because it separates the HTML code from the JS and CSS codes. It also is more efficient (has a better performance) because *************** *** 174,182 **** <ul> <li>All the templates of the application are placed in the folder ! <em>/templates/</em>. We tell to the framework where to look for the templates by giving an appropriate value to the constant <strong>TPL_PATH</strong> in the file ! <a href="javascript:codeReview('{{APP2_PATH}}config/const.Paths.php','4')"> <em>config/const.Paths.php</em></a>. <br /> --- 174,182 ---- <ul> <li>All the templates of the application are placed in the folder ! <em>templates/</em>. We tell to the framework where to look for the templates by giving an appropriate value to the constant <strong>TPL_PATH</strong> in the file ! <a href="javascript:codeReview('{{APP2_PATH}}config/const.Paths.php','6')"> <em>config/const.Paths.php</em></a>. <br /> *************** *** 184,188 **** <li>All the images of this application are placed in the folder ! <em>/img/</em>. In templates they are linked using the <strong>{{#IMG_URL}}</strong> variable. <a href="javascript:codeReview('{{APP2_PATH}}templates/footer.html','9,10')"> --- 184,188 ---- <li>All the images of this application are placed in the folder ! <em>img/</em>. In templates they are linked using the <strong>{{#IMG_URL}}</strong> variable. <a href="javascript:codeReview('{{APP2_PATH}}templates/footer.html','9,10')"> *************** *** 190,194 **** variable gets the value from the PHP constant <strong>IMG_URL</strong>, which is declared in the file ! <a href="javascript:codeReview('{{APP2_PATH}}config/const.Paths.php','6')"> <em>config/const.Paths.php</em></a>. <br /> --- 190,194 ---- variable gets the value from the PHP constant <strong>IMG_URL</strong>, which is declared in the file ! <a href="javascript:codeReview('{{APP2_PATH}}config/const.Paths.php','8')"> <em>config/const.Paths.php</em></a>. <br /> *************** *** 196,200 **** <li>All the files and templates of the page3 are placed in the ! folder <em>/templates/page3/</em>. Organizing files into folders and subfolders reduces the complexity of the application and makes it easier to be understood and maintained. --- 196,200 ---- <li>All the files and templates of the page3 are placed in the ! folder <em>templates/page3/</em>. Organizing files into folders and subfolders reduces the complexity of the application and makes it easier to be understood and maintained. *************** *** 205,209 **** <li>All the pages include the same header and footer template, e.g. see ! <a href="javascript:codeReview('{{APP2_PATH}}templates/page1.html','7,9')"> page1.html</a>. If you want to change something in the footer of the page, then you don't have to change every page, but you make --- 205,209 ---- <li>All the pages include the same header and footer template, e.g. see ! <a href="javascript:codeReview('{{APP2_PATH}}templates/page1.html','12,14')"> page1.html</a>. If you want to change something in the footer of the page, then you don't have to change every page, but you make *************** *** 221,225 **** <li>Browse the files and see the template <em>page2.html</em> and all ! the templates in the folder <em>/templates/page3/</em>. See them both in preview mode and in code view mode. These two pages are the same in terms of what they display, however they are implemented --- 221,225 ---- <li>Browse the files and see the template <em>page2.html</em> and all ! the templates in the folder <em>templates/page3/</em>. See them both in preview mode and in code view mode. These two pages are the same in terms of what they display, however they are implemented *************** *** 259,263 **** <li>Open the file ! <a href="javascript:codeReview('{{APP2_PATH}}templates/page2.html','60')"> page2.html</a> and change the text in the highlighted lines to "This box is red!".</li> --- 259,263 ---- <li>Open the file ! <a href="javascript:codeReview('{{APP2_PATH}}templates/page2.html','64')"> page2.html</a> and change the text in the highlighted lines to "This box is red!".</li> *************** *** 291,297 **** <li>Change the value of the <strong>IMG_URL</strong> constant in the file ! <a href="javascript:codeReview('{{APP2_PATH}}config/const.Paths.php','6')"> const.Paths.php</a>. ! Reload the application. The images should be allright.</li> </ol> --- 291,297 ---- <li>Change the value of the <strong>IMG_URL</strong> constant in the file ! <a href="javascript:codeReview('{{APP2_PATH}}config/const.Paths.php','8')"> const.Paths.php</a>. ! Reload the application. The images should be alright.</li> </ol> *************** *** 354,358 **** <li>If you test the application now, you will get an error. Open the file ! <a href="javascript:codeReview('{{APP2_PATH}}config/const.Options.php','9-13')"> <em>config/const.Options.php</em></a> and change the value of the constant <strong>FIRSTPAGE</strong> to "page1/page1.html".</li> --- 354,358 ---- <li>If you test the application now, you will get an error. Open the file ! <a href="javascript:codeReview('{{APP2_PATH}}config/const.Options.php','30-34')"> <em>config/const.Options.php</em></a> and change the value of the constant <strong>FIRSTPAGE</strong> to "page1/page1.html".</li> *************** *** 360,364 **** <li>If you test the application now, it will not be able to find the stylesheet and the header and footer templates. Open the file ! <a href="javascript:codeReview('{{APP2_PATH}}templates/page1.html','4,7,9','')"> <em>page1/page1.html</em></a> and replace <strong>{{#./}}</strong> with <strong>{{#TPL_URL}}</strong> for the stylesheet, and with --- 360,364 ---- <li>If you test the application now, it will not be able to find the stylesheet and the header and footer templates. Open the file ! <a href="javascript:codeReview('{{APP2_PATH}}templates/page1.html','8,12,14','')"> <em>page1/page1.html</em></a> and replace <strong>{{#./}}</strong> with <strong>{{#TPL_URL}}</strong> for the stylesheet, and with *************** *** 382,386 **** <ol> ! <li>In the folder <em>/templates/page1/</em> create the file <em>page1_content.css</em> which has these lines: <pre> --- 382,386 ---- <ol> ! <li>In the folder <em>templates/page1/</em> create the file <em>page1_content.css</em> which has these lines: <pre> *************** *** 425,438 **** <ul> ! <li>Create a new folder <em>/templates/page2/</em> and move the files <em>page2.html</em> and <em>page2.css</em> to it.</li> ! <li>Create a new folder <em>/templates/page3/tpl_1</em> and move the files <em>tpl_1.html</em> and <em>tpl_1.css</em> to it.</li> ! <li>Create a new folder <em>/templates/page3/tpl_2/tpl_2_1</em> and move the files <em>tpl_2_1.html</em> and <em>tpl_2_1.css</em> to it.</li> ! <li>Create a new folder <em>/templates/page3/tpl_2/tpl_2_2</em> and move the files <em>tpl_2_2.html</em> and <em>tpl_2_2.css</em> to it.</li> </ul> --- 425,438 ---- <ul> ! <li>Create a new folder <em>templates/page2/</em> and move the files <em>page2.html</em> and <em>page2.css</em> to it.</li> ! <li>Create a new folder <em>templates/page3/tpl_1</em> and move the files <em>tpl_1.html</em> and <em>tpl_1.css</em> to it.</li> ! <li>Create a new folder <em>templates/page3/tpl_2/tpl_2_1</em> and move the files <em>tpl_2_1.html</em> and <em>tpl_2_1.css</em> to it.</li> ! <li>Create a new folder <em>templates/page3/tpl_2/tpl_2_2</em> and move the files <em>tpl_2_2.html</em> and <em>tpl_2_2.css</em> to it.</li> </ul> *************** *** 442,446 **** <ol> <li>Open the file ! <a href="javascript:codeReview('{{APP2_PATH}}config/const.Debug.php','18-22')"> <em>config/const.Debug.php</em></a> and set the constant <strong>DEBUG_TEMPLATES</strong> to <em>true</em>.</li> --- 442,446 ---- <ol> <li>Open the file ! <a href="javascript:codeReview('{{APP2_PATH}}config/const.Debug.php','39-43')"> <em>config/const.Debug.php</em></a> and set the constant <strong>DEBUG_TEMPLATES</strong> to <em>true</em>.</li> *************** *** 452,456 **** <p>Suppose that you would like to add the current date at the top ! of each file (whithout using JavaScript, using PHP). How would you do it? Or, in general, how could you display something from PHP in the page?</p> --- 452,456 ---- <p>Suppose that you would like to add the current date at the top ! of each file (without using JavaScript, using PHP). How would you do it? Or, in general, how could you display something from PHP in the page?</p> Index: intro.html =================================================================== RCS file: /cvsroot/phpwebapp/documentation/templates/tutorial/intro.html,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** intro.html 21 Jul 2004 17:15:32 -0000 1.6 --- intro.html 29 Jul 2004 14:43:36 -0000 1.7 *************** *** 1,3 **** ! <p>The tutorial consists of a list of sample applications which are built using phpWebApp. Each application uses some features of phpWebApp and has explanations about the features used. It also has --- 1,3 ---- ! <p>The tutorial consists of some sample applications which are built using phpWebApp. Each application uses some features of phpWebApp and has explanations about the features used. It also has *************** *** 56,60 **** code of the weboxes declares the function onRender(), where some variables are added using WebApp::addVar(), and these ! {{variables}} are used in the corresponding template. </td> --- 56,60 ---- code of the weboxes declares the function onRender(), where some variables are added using WebApp::addVar(), and these ! {{#variables}} are used in the corresponding template. </td> *************** *** 79,83 **** <br /> Explains what are the session variables and how to use them. ! Explains further how the {{template variables}} are evaluated. Explains how the session variables are used to keep the state of the weboxes and the states of the application (introduces --- 79,83 ---- <br /> Explains what are the session variables and how to use them. ! Explains further how the {{#template variables}} are evaluated. Explains how the session variables are used to keep the state of the weboxes and the states of the application (introduces |