fix editing mistakes
This commit is contained in:
@@ -50,10 +50,10 @@ def hello3():
|
||||
|
||||
<b>and view: simple_examples/hello3.html</b>
|
||||
{{=CODE(open(os.path.join(request.folder,'views/simple_examples/hello3.html'),'r').read(),language='html',link=URL('global','vars'),_class='boxCode')}}
|
||||
<p>If you return a dictionary, the variables defined in the dictionery are visible to the view (template).
|
||||
<p>If you return a dictionary, the variables defined in the dictionary are visible to the view (template).
|
||||
<br/>Try it here: <a class="btn" href="/{{=request.application}}/simple_examples/hello3.html">hello3</a></p>
|
||||
|
||||
<p>Actions can also be be rendered in other formsts like JSON, <a href="/{{=request.application}}/simple_examples/hello3.json">hello3.json</a>, and XML, <a href="/{{=request.application}}/simple_examples/hello3.xml">hello3.xml</a></p>
|
||||
<p>Actions can also be be rendered in other forms like JSON, <a href="/{{=request.application}}/simple_examples/hello3.json">hello3.json</a>, and XML, <a href="/{{=request.application}}/simple_examples/hello3.xml">hello3.xml</a></p>
|
||||
|
||||
<h3>Example {{=c}}{{c+=1}}</h3><b>In controller: simple_examples.py</b>
|
||||
{{=CODE("""
|
||||
@@ -69,7 +69,7 @@ def hello4():
|
||||
def hello5():
|
||||
return HTML(BODY(H1(T('Hello World'),_style="color: red;"))).xml() # .xml to serialize
|
||||
""".strip(),language='web2py',link=URL('global','vars'),_class='boxCode')}}
|
||||
<p>You can also generate HTML using helper objects HTML, BODY, H1, etc. Each of these tags is a class and the views know how to render the corresponding objects. The method .xml() serializes them and produce html/xml code for the page.
|
||||
<p>You can also generate HTML using helper objects HTML, BODY, H1, etc. Each of these tags is a class and the views know how to render the corresponding objects. The method .xml() serializes them and produces html/xml code for the page.
|
||||
Each tag, DIV for example, takes three types of arguments:</p>
|
||||
<ul>
|
||||
<li>unnamed arguments, they correspond to nested tags</li>
|
||||
@@ -201,11 +201,11 @@ def ajaxwiki_onclick():
|
||||
<h3>Example {{=c}}{{c+=1}}</h3><b>In controller: session_examples.py </b>
|
||||
{{=CODE("""
|
||||
def counter():
|
||||
session.counter = (sesstion.counter or 0) + 1
|
||||
session.counter = (session.counter or 0) + 1
|
||||
return dict(counter=session.counter)
|
||||
""".strip(),language='web2py',link=URL('global','vars'),_class='boxCode')}}<b>and view: session_examples/counter.html</b>
|
||||
{{=CODE(open(os.path.join(request.folder,'views/session_examples/counter.html'),'r').read(),language='html',link=URL('global','vars'),_class='boxCode')}}
|
||||
<p>Click to count. The session.counter is persistent for this user and application. Every applicaiton within the system has its own separate session management.
|
||||
<p>Click to count. The session.counter is persistent for this user and application. Every application within the system has its own separate session management.
|
||||
<br/>Try it here: <a class="btn" href="/{{=request.application}}/session_examples/counter">counter</a></p>
|
||||
|
||||
<h2 id="template_examples">Template Examples</h2>
|
||||
|
||||
Reference in New Issue
Block a user