| |
|
1 |
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Templates</title> |
| |
|
2 |
</head> |
| |
|
3 |
<body bgcolor="white"><table border="1" width="100%"><tbody><tr><td><table border="1" bgcolor="#ffffff" cellpadding="10" cellspacing="0" width="100%" color="#ffffff"><tbody><tr><td><font face="arial,sans-serif" color="black" size="-1">This is <b><font color="#0039b6">G</font> <font color="#c41200">o</font> <font color="#f3c518">o</font> <font color="#0039b6">g</font> <font color="#30a72f">l</font> <font color="#c41200">e</font></b>'s <a href="http://www.google.com/help/features.html#cached"><font color="blue">cache</font></a> of <a href="http://etp.museatech.net/etpdoc/templates"><font color="blue">http://etp.museatech.net/etpdoc/templates</font></a>.<br> |
| |
|
4 |
<b><font color="#0039b6">G</font> <font color="#c41200">o</font> <font color="#f3c518">o</font> <font color="#0039b6">g</font> <font color="#30a72f">l</font> <font color="#c41200">e</font></b>'s cache is the snapshot that we took of the page as we crawled the web.<br> |
| |
|
5 |
The page may have changed since that time. Click here for the <a href="http://etp.museatech.net/etpdoc/templates"><font color="blue">current page</font></a> without highlighting.<br>To link to or bookmark this page, use the following url: <code>http://www.google.com/search?q=cache:kaDJjn1RdBYC:etp.museatech.net/etpdoc/templates+etp+documentation+site:etp.museatech.net&hl=en&ie=UTF-8</code></font><br><br><center><font size="-2"><i>Google is not affiliated with the authors of this page nor responsible for its content.</i></font></center></td></tr> |
| |
|
6 |
<tr><td> |
| |
|
7 |
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td><font face="arial,sans-serif" color="black" size="-1">These search terms have been highlighted:�</font></td><td bgcolor="#ffff66"><b><font face="arial,sans-serif" color="black" size="-1">etp�</font></b></td><td bgcolor="#a0ffff"><b><font face="arial,sans-serif" color="black" size="-1">documentation�</font></b></td></tr></tbody></table> |
| |
|
8 |
</td></tr></tbody></table></td></tr></tbody></table> |
| |
|
9 |
<hr> |
| |
|
10 |
|
| |
|
11 |
|
| |
|
12 |
|
| |
|
13 |
|
| |
|
14 |
|
| |
|
15 |
|
| |
|
16 |
|
| |
|
17 |
<a href="http://www.museatech.net/"> |
| |
|
18 |
<img border="0" align="right" width="179" height="115" src="templates_files/musealogo.jpg" alt="A Musea Technologies Project"> |
| |
|
19 |
</a> |
| |
|
20 |
|
| |
|
21 |
<h2>Templates</h2> |
| |
|
22 |
|
| |
|
23 |
<span class="text"> |
| |
|
24 |
<a href="http://etp.museatech.net/">Edit This Page Demonstration</a> : <a href="http://etp.museatech.net/etpdoc/"><b style="color: black; background-color: rgb(255, 255, 102);">ETP </b><b style="color: black; background-color: rgb(160, 255, 255);">Documentation</b></a> : Templates |
| |
|
25 |
</span> |
| |
|
26 |
|
| |
|
27 |
<br clear="right"> |
| |
|
28 |
<hr> |
| |
|
29 |
|
| |
|
30 |
<span class="text"> |
| |
|
31 |
|
| |
|
32 |
|
| |
|
33 |
To use <b style="color: black; background-color: rgb(255, 255, 102);">ETP</b>, or in fact to effectively use OpenACS 4, it's essential that you become familiar with the <a href="http://etp.museatech.net/doc/acs-templating/">ArsDigita Templating System</a>. <b style="color: black; background-color: rgb(255, 255, 102);">ETP's</b> |
| |
|
34 |
support for rapid application development includes procedures for creating |
| |
|
35 |
the data sources that will be used by your page templates. You can copy |
| |
|
36 |
code from the examples in the <code>packages/editthispage/templates</code> directory to get started, but here's an overview of what you need to know. |
| |
|
37 |
|
| |
|
38 |
<h3>Providing the "Edit this page" link</h3> |
| |
|
39 |
As demonstrated in <code>packages/editthispage/www/master.tcl</code>, you should call the procedure <b><b style="color: black; background-color: rgb(255, 255, 102);">etp</b>::get_etp_link</b> |
| |
|
40 |
from your own master template, in order to determine whether or not to present |
| |
|
41 |
the user with the "Edit this page" option. The procedure returns the html |
| |
|
42 |
link only within an instance of the <b style="color: black; background-color: rgb(255, 255, 102);">ETP</b> package, and then only if the user has write access. Otherwise an empty string is returned. |
| |
|
43 |
|
| |
|
44 |
<h3>Retrieving page attributes for the template to display</h3> |
| |
|
45 |
Every <b style="color: black; background-color: rgb(255, 255, 102);">ETP</b> template will make use of the <b><b style="color: black; background-color: rgb(255, 255, 102);">etp</b>::get_page_attributes</b> procedure. It creates an array variable called <code>pa</code> in the caller's stack frame, |
| |
|
46 |
containing all the attributes necessary to render the current page. |
| |
|
47 |
These attributes include the standard elements from the cr_revisions |
| |
|
48 |
table such as title, description, and content. If the page is using |
| |
|
49 |
a <a href="http://etp.museatech.net/etpdoc/contenttype">custom content type</a>, any extended page |
| |
|
50 |
attributes that correspond to it will be included. |
| |
|
51 |
<p> |
| |
|
52 |
The complete list of standard attributes in the pa array is as follows: |
| |
|
53 |
</p><ul> |
| |
|
54 |
<li>item_id |
| |
|
55 |
</li><li>name |
| |
|
56 |
</li><li>revision_id |
| |
|
57 |
</li><li>title |
| |
|
58 |
</li><li>context_bar |
| |
|
59 |
</li><li>description |
| |
|
60 |
</li><li>publish_date |
| |
|
61 |
</li><li>content |
| |
|
62 |
</li><li><i>extended attributes, if any, defined by <b style="color: black; background-color: rgb(255, 255, 102);">etp</b>::make_content_type</i> |
| |
|
63 |
</li></ul> |
| |
|
64 |
The procedure is designed to be efficient under heavy load. The database |
| |
|
65 |
is accessed once to retrieve the attributes, and a second time to generate |
| |
|
66 |
the page's context bar. The resulting array is then cached in the server's |
| |
|
67 |
memory until someone edits it.<p> |
| |
|
68 |
Once the <code>pa</code> array variable has been created as a template |
| |
|
69 |
data source, the template itself may reference the values it contains using |
| |
|
70 |
the standard syntax for "onerow" data sources; for example, <code>@pa.content@</code>. |
| |
|
71 |
|
| |
|
72 |
</p><h3>Retrieving the list of pages in a content section</h3> |
| |
|
73 |
<b style="color: black; background-color: rgb(255, 255, 102);">ETP</b> templates used for the index page will almost always make use of the <b><b style="color: black; background-color: rgb(255, 255, 102);">etp</b>::get_content_items</b> procedure. It creates a variable called <code>content_items</code> |
| |
|
74 |
in the caller's stack frame. This is a multirow result set suitable for |
| |
|
75 |
passing to an index template, containing all the structured data necessary |
| |
|
76 |
to present a list of links to content pages, folders, extlinks, or symlinks. |
| |
|
77 |
By making use of the procedure's switches you may modify the query results |
| |
|
78 |
it produces: <code> |
| |
|
79 |
<ul> |
| |
|
80 |
<li> -attributes [list] - list of additional page attributes to return (when required for display) |
| |
|
81 |
</li><li> -orderby [list] - list of columns on which to sort. |
| |
|
82 |
</li><li> -where [list] - list of SQL where clauses to restrict the query. |
| |
|
83 |
</li></ul></code> |
| |
|
84 |
|
| |
|
85 |
Each row in the result set always contains values for the following page attributes: |
| |
|
86 |
<ul> |
| |
|
87 |
<li>name |
| |
|
88 |
</li><li>url (use this to generate a link to this item) |
| |
|
89 |
</li><li>title |
| |
|
90 |
</li><li>description |
| |
|
91 |
</li><li>object_type |
| |
|
92 |
</li><li>publish_date |
| |
|
93 |
</li><li>item_id |
| |
|
94 |
</li></ul> |
| |
|
95 |
|
| |
|
96 |
Additionally, you may name additional attributes that will be |
| |
|
97 |
returned, either from the standard page attributes stored in |
| |
|
98 |
cr_revisions, or extended page attributes defined with |
| |
|
99 |
<b style="color: black; background-color: rgb(255, 255, 102);">etp</b>::make_content_type. |
| |
|
100 |
<p> |
| |
|
101 |
The content_items variable is created with a single db query, |
| |
|
102 |
and currently is never cached. |
| |
|
103 |
|
| |
|
104 |
</p></span> |
| |
|
105 |
|
| |
|
106 |
<hr> |
| |
|
107 |
<table width="100%"> |
| |
|
108 |
<tbody><tr> |
| |
|
109 |
<td><address><a href="mailto:luke@museatech.net">luke@museatech.net</a></address></td> |
| |
|
110 |
|
| |
|
111 |
</tr> |
| |
|
112 |
</tbody></table> |
| |
|
113 |
|
| |
|
114 |
</body></html> |