File: dynamic_includes.htm

package info (click to toggle)
libapache-asp-perl 2.63-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 4,120 kB
  • sloc: perl: 6,044; php: 409; sh: 62; lisp: 22; makefile: 10
file content (58 lines) | stat: -rwxr-xr-x 1,589 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/perl /usr/bin/asp-perl

<% $Response->Include('header.inc', bgcolor => $Request->Form('color') || 'white'); %>
<h3> Demonstration of dynamic includes. </h3>
<table border=0>
<tr>
	<td>
		<form name=color method=post>
		<input type=text name=color value="<%=$Request->Form('color') || 'white' %>">
		</form>
	</td>
	<td>
	This first example demonstrates dynamic includes SSI style.
	First try entering a color in the box to be passed as a runtime argument to the
	included header for this file.  Just hit enter after typing in the color.
	</td>
</tr>
</table>

<table border=0>
<tr>
	<td>
		<form method=post>
		<input type=text name=size value="<%=$Request->Form('size')%>">
		</form>
	</td>
	<td>
	Now to show you how to access dynamic includes through the API
	extension $Response->Include($filename, @args)... please
	enter a number of columns less than 10 in the text box, and a grid will
	be produce below of that size.
	</td>
</tr>
<tr>
	<td colspan=2>
	<%
	my $size = $Request->Form('size');
	if($size > 0 and $size <= 10) {		
	    # Response->Include() and Server->Execute do the same things
	    # but the former is the native solution, and the latter comes
	    # from the recent IIS/ASP 3.0 API extension.  Formally, Execute()
	    # doesn't take arguments, but we allow this functionality.
	    if($size % 2) {
		$Response->Include('table.inc', $size);
	    } else {
	        $Server->Execute('table.inc', $size);
	    }
	} else {
		print "Please enter a valid number from 1 to 10 in the form.\n";
	}    
	%>
	</td>
</tr>
</table>

<!--#include file=footer.inc-->