[lp_header_serveXHTML]

Description

Link: [lp_header_serveXHTML]
Author: Bil Corry
Category: Technical
Version: 8.x
License: Public Domain
Posted: Jan. 20, 2006
Updated: May. 05, 2006
More by this author...
Via header, sets content type to serve XHTML using content-negotiation.    It will force Lasso to send the page in the character set specified in Lasso Admin (default) or use the -encoding param.

Note: this will specify "application/xhtml+xml" as the content type for any browser that advertises it understands it.  Your XHTML page must be well-formed or the browser will complain instead of showing your webpage.

Parameters

-encoding string, optional Character set for the page. Default is to use the Lasso default character set.

Sample Usage

lp_header_serveXHTML;
						

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
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
[

define_tag:'lp_header_serveXHTML',
	-description='Via header, sets content type to serve XHTML using content-negotiation.',
	-priority='replace',
	-optional='encoding';

	// http://www.xml.com/pub/a/2003/03/19/dive-into-xml.html
	// http://www.w3.org/TR/xhtml-media-types/#application-xhtml-xml
	// http://www.w3.org/People/mimasa/test/xhtml/media-types/results
	// http://simon.incutio.com/archive/2003/05/06/knifeEdge

	// internal var that lets other ctags know it's XHTML
	var:'_lp_xhtml' = true;

	// set encoding
	if: !(local_defined:'encoding');
		local:'encoding' = $__encoding__; // use Lasso default encoding
	/if;	

	// set content type
	if: client_headers->(contains:'application/xhtml+xml'); // accepts XHTML content-type?
		content_type:'application/xhtml+xml; charset=' #encoding;
	else; // server XHTML as HTML content type
		content_type: 'text/html; charset=' #encoding;
	/if;
	
	// set vary header
	if: !$__http_header__->(contains:'vary:');
		$__http_header__ += 'Vary: *\r\n';
	/if;
	
/define_tag;

]

 

Related Tags



Comments

none

Email:


Password:



Newest

Most Popular