Changeset 4824

Show
Ignore:
Timestamp:
06/26/08 21:34:30 (7 months ago)
Author:
fredlin
Message:

update about doc.... I think template explanations are too detail, compared with the upper parts. wanna put them into online doc?

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • projects/tg.devtools/trunk/devtools/templates/turbogears/+package+/templates/about.html

    r4797 r4824  
    2323    <ol id="getting_started_steps"> 
    2424      <li class="getting_started"> 
    25         <h3>Code your data model</h3> 
    26         <p> If you didn't enable identity, there's no data-model, because we don't know what you need.  And TG you can build a dynamic site without any data model at all.</p> 
    27         <p> But when/if you want a model for storing your favorite links or wiki content, the /model folder in your site is ready to go. .</p> 
     25        <h3>Code my data model</h3> 
     26        <p> When you want a model for storing favorite links or wiki content, the <strong>/model</strong> folder in your site is ready to go. .</p> 
     27        <p> You can build a dynamic site without any data model at all. There still be a default data-model template for you if you didn't enable identity in quickstart. If you enable identity, you'll got identity data-model settled for you.</p> 
    2828      </li> 
    2929      <li class="getting_started"> 
    30         <h3>Design your site architecture</h3> 
    31         <p> The "<span class="code">root.py</span>" file has your URLs, all two of them.  When you called this url (<span class="code">about</span>), the command went through the RootController class to the <span class="code">about</span><span class="code">()</span> method. </p> 
    32         <p> That method uses Python code to create a dictionary of variables that you'll use in your template.</p> 
     30        <h3>Design my site architecture</h3> 
     31        <p> The "<span class="code">root.py</span>" file under the <strong>/controllers</strong> folder has your URLs.  When you called this url (<span class="code"><a href="/about">about</a></span>), the command went through the RootController class to the <span class="code">about</span><span class="code">()</span> method. </p> 
     32        <p> Those Python methods are responsible to create the dictionary of variables that will be used in your web views (template).</p> 
    3333      </li> 
    3434      <li class="getting_started"> 
    35         <h3>Parts of the Page</h3> 
    36         <p> This "about" page consists of several separate templates, each one generating a part of the page.  There's a master.html, sidebars.html, header.html and footer.html in addition to the about.html template we mentioned above. We'll cover them in the order they are found, listed near the top of the about.html template</p> 
    37         <p> <strong><span class="code">header.html</span></strong> - The "header.html" template contains the HTML code to display the blue gradient, TG2 logo, and some site text at the top of every page it is included on.  When the "about.html" template is called, it includes this "header.html" template (and the others) with a <span class="code">&lt;xi:include /&gt;</span> tag, part of the Genshi templating system.  But the "header.html" template isn't completely static HTML -- it also dynamically displays the current page name with a Genshi template method called "replace".  The code looks like this: <span class="code">&lt;span py:replace="page"/&gt;</span>, and it means: Replace this <span class="code">&lt;span /&gt;</span> with the contents found in the variable 'page' that has been sent in the dictionary to this "about.html" template, and is available through that namespace for use by this "header.html" template.  That's how it changes in the header depending on what page you are visiting. 
     35        <h3>Reuse the web page elements</h3> 
     36        <p> A web page viewed by user could be constructed by single or several reusable templates under <strong>/templates</strong>. Take 'about' page for example, each reusable templates generating a part of the page. We'll cover them in the order of where they are found, listed near the top of the about.html template</p> 
     37        <p> <strong><span class="code">header.html</span></strong> - The "header.html" template contains the HTML code to display the 'header': The blue gradient, TG2 logo, and some site text at the top of every page it is included on. When the "about.html" template is called, it includes this "header.html" template (and the others) with a <span class="code">&lt;xi:include /&gt;</span> tag, part of the Genshi templating system. The "header.html" template is not a completely static HTML -- it also dynamically displays the current page name with a Genshi template method called "replace" with the code: <span class="code">&lt;span py:replace="page"/&gt;</span>. It means replace this <span class="code">&lt;span /&gt;</span> region with the contents found in the variable 'page' that has been sent in the dictionary to this "about.html" template, and is available through that namespace for use by this "header.html" template.  That's how it changes in the header depending on what page you are visiting. 
    3838        </p> 
    3939        <p> <strong><span class="code">sidebars.html</span></strong> - The sidebars (navigation areas on the right side of the page) are generated as two separate <span class="code">py:def</span> blocks in the "sidebars.html" template.  The <span class="code">py:def</span> construct is best thought of as a "macro" code... a simple way to separate and reuse common code snippets.  All it takes to include these on the "about.html" page template is to write  <span class="code">