[SparForte][Banner]
[Top Main Menu] Intro | Tutorials | Reference | Packages | Examples | Contributors   [Back Page]      [Next Page]  

Templates Package

The SparForte Templates package contains addtional features for tempates. This includes controlling the HTTP result header.

b := has_put_template_header

 

True if the template header has already been written.

Example

if templates.has_put_template_header then
  put_line( "Safe to write!");
end if;

Parameters

Param Mode Type Default Description
s return value boolean required True if the header has been written

Exceptions

-

See Also

templates.put_template_header

Compare With

-

put_template_header

 

Write the HTTP result header. If it has already been written, do nothing. Normally, SparForte will write an HTTP header before processing a template. Use this procedure to write it out earlier, used before any output from your script.

Example

templates.put_template_header;
-- Status: 200 OK
-- ... etc.

Exceptions

An exception may be raised of pragma template is not called first.

See Also

templates.has_put_template_header

Compare With

-

set_http_location( s )

 

Set the template header HTTP location field to the URL string s. This is typically used with redirect HTTP responses.

Example

templates.set_http_status( 302 );
templates.set_http_location( "/redirect.html" );

Parameters

Param Mode Type Default Description
s in string required the redirect URL

Exceptions

It is an error to set an empty URL.

See Also

-

Compare With

-

set_http_status( n )

 

Set the template header HTTP status code to the natural n. The default status for a template is 200 (OK).

Example

templates.set_http_status( 404 ); -- not found

Parameters

Param Mode Type Default Description
n in natural required the status code

Exceptions

The status code must be range 100..505.

See Also

-

Compare With

-

[Right Submenu]

 Summary

 arrays

 btree_io

 calendar

 cgi

 chains

 command_line

 db/ postgresql

 dbm

 directory_operations

 doubly_linked...

 dynamic_hash_...

 enums

 exceptions

 files

 gnat.cgi

 gnat.crc32

 hash_io

 lock_files

 memcache

 memcache.highread

 mysql

 mysqlm

 numerics

 os

 pen

 pen (OpenGL)

 records

 sound

 source_info

 stats

 strings

 System

 teams

 templates

 text_io

 units

[Back to Top] Back To Top [Small Forte Symbol]