Index: openacs-4/packages/acs-templating/www/doc/guide/master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/guide/master.adp,v diff -u -r1.5.2.1 -r1.5.2.2 --- openacs-4/packages/acs-templating/www/doc/guide/master.adp 3 Sep 2021 09:16:21 -0000 1.5.2.1 +++ openacs-4/packages/acs-templating/www/doc/guide/master.adp 13 Jul 2023 12:48:33 -0000 1.5.2.2 @@ -45,7 +45,8 @@

Write the Master Template

A master template to implement the page layout shown above would have this basic structure:

-
<html><body><table width="100%" cellspacing="0" cellpadding="0" border="0">
+
+<html><body><table width="100%" cellspacing="0" cellpadding="0" border="0">
 
 <tr>
   <td><!-- LOGO --></td>
@@ -64,7 +65,8 @@
 
 <tr><td colspan="3"><!-- FOOTER --></td></tr>
 
-</table></body></html>
+</table></body></html> +

The only special feature of this master template is the slave tag, which marks the location of the content area. Note that the content is inserted into the master template as a @@ -76,13 +78,15 @@

Write the Page Template(s)

A page template must include a master tag to specify that its output should be enclosed in a master template:

-
<master src="/templates/master">
+
+<master src="/templates/master">
 
 <!--Begin layout of page content-->
 <h3>\@title\@</h3>
 <p>by \@name\@</p>
 <p><b>\@byline\@</b>: \@text</p>
-...
+... +

The master tag may be included anywhere in the body of the page template, although usually the top of the file is the best location for it.

@@ -93,26 +97,32 @@ user's name on every page to indicate that the site has been personalized. The Tcl script associated with the master template would include code like this:

-
set user_name [your_procedure_to_get_the_current_user_name]
+
+set user_name [your_procedure_to_get_the_current_user_name]
+

The template would have a section like this:

-
<if \@user_name\@ nil>
+
+<if \@user_name\@ nil>
   <a href="/register.acs">Register Now!</a>
 </if>
 <else>
   \@user_name\@ (<a href="/signout.acs">Sign Out</a>)
-</else>
+</else> +

Passing Property Values from the Page Template to Master Template

As mentioned above, in many cases the dynamic elements of the master template depend on whatever is appearing in the content area for a particular request. The property tag may be used in the page template to specify values that should be passed to the master template:

-
<master src="/templates/master">
+
+<master src="/templates/master">
 <property name="title">\@title\@</property>
 
 <!--Begin layout of page content-->
-...
+... +

In this case, the property tag establishes title as a data source for the master template. Properties are set as regular Tcl variables prior to executing the