Switch layouts home | FAQ | | P1 | P2 | P3 | P4 | P5 |  | A1 | A2 | A3  | | B1

Includes and Inserts

1. Create a copy or a link to PB. It may be either a hard link or a symbolic link depending on your preferences and settings of the web server. The name of the link can be anything as long as the web server is going to run it as a cgi script. For example, p2.cgi
ln ../cgi-bin/pb.pl ./p2.cgi    or
ln -sf ../cgi-bin/pb.pl ./p2.cgi

2. Create four template files:
- p2-header.html
<html><head>
<title>PB:Includes</title>
</head>
<body>
header
<hr>

- p2-home.html
<!%include $Template{header}%>
<center><H3>The world is a wonderful place to be</H3>
<TABLE border="1">
<TH colspan="2"><!%include $Template{inserts},theader%></TH>
<TR><TD><!%include $Template{inserts},<!%show 1%>%></TD><TD><!%include $Template{inserts},2%></TD></TR>
<TR><TD colspan="2" align="center"><!%include $Template{inserts},1-2Combo%></TD></TR>
</TABLE>
</center>
<!%include $Template{tail}%>

- p2-tail.html
<hr>
<div align="right"><i>Sample</i></div>
</body></html>

- inserts.txt
<!%insert theader%> 
This is an example of using inserts
<!%endinsert theader%>
<!%insert 1,1-2Combo%>Insert 1<!%endinsert 1%>
+
<!%insert 2%>Insert 2<!%endinsert 2,1-2Combo%> 

3. Create a project configuration file. The name should be cgi-script's name + ".pm". For p2.cgi this file should be ./p2.cgi.pm
$templatesdir="sampledir";
$Parameter{Page}="home"; 
$Template{header}="$templatesdir/p2-header.html";
$Template{home}="$templatesdir/p2-home.html";
$Template{tail}="$templatesdir/p2-tail.html";
$Template{inserts}="$templatesdir/inserts.txt";
1;

4. This web project is complete. Check it out:
/PB/p2.cgi


2002-03