Index: openacs-4/packages/acs-core-docs/www/templates.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/templates.html,v diff -u -r1.40 -r1.41 --- openacs-4/packages/acs-core-docs/www/templates.html 16 Feb 2005 00:21:03 -0000 1.40 +++ openacs-4/packages/acs-core-docs/www/templates.html 4 Jun 2006 00:45:25 -0000 1.41 @@ -1,4 +1,5 @@ -Using Templates in OpenACS

Using Templates in OpenACS

By Pete Su

+ +Using Templates in OpenACS

Using Templates in OpenACS

By Pete Su

OpenACS docs are written by the named authors, and may be edited by OpenACS documentation staff.

Overview

@@ -68,12 +69,12 @@ where forum_id = :user_id } -set page_title "Add a note for $user_name" -set submit_label "Add" -set target "note-add-2" +set page_title "Add a note for $user_name" +set submit_label "Add" +set target "note-add-2" set note_id [db_nextval acs_object_id_seq] -ad_return_template "note-add" +ad_return_template "note-add"

Some things to note about this code: @@ -110,27 +111,27 @@ and insert this text:

 
-<master src="master">
-<property name="title">@page_title@</property>
-<property name="context_bar">@context_bar@</property>
+<master src="master">
+<property name="title">@page_title@</property>
+<property name="context_bar">@context_bar@</property>
 
 <form action=@target@>
 <p>Title: 
-<input type="text" name="title" value="">
+<input type="text" name="title" value="">
 </p>
 <p>Body: 
-<input type="text" name="title" value="">
+<input type="text" name="title" value="">
 </p>
 <p>
 <center>
-<input type=submit value="@submit_label@">
+<input type=submit value="@submit_label@">
 </center>
 </p>
 </form>
 
 

The main point to note here is: when you want to substitute a value -into a page, you put the name of the data source between two "@" +into a page, you put the name of the data source between two "@" characters. Another point to note is the use of a master template: Master templates allow you do centralize display code that is used throughout an application in a single file. In this case, we intend to @@ -144,7 +145,7 @@ <%= [eval ad_context_bar $context_bar] %> <hr> <slave> -<br clear="all"> +<br clear="all"> <%= [ad_footer] %>