Apache::AxKit::StyleChooser::Hostname - Choose stylesheet using the hostname of the HTTP request


Apache-AxKit-StyleChooser-Hostname documentation Contained in the Apache-AxKit-StyleChooser-Hostname distribution.

Index


Code Index:

NAME

Top

Apache::AxKit::StyleChooser::Hostname - Choose stylesheet using the hostname of the HTTP request

SYNOPSIS

Top

  AxAddPlugin Apache::AxKit::StyleChooser::Hostname

DESCRIPTION

Top

This module lets you pick a stylesheet based on the domain name of the HTTP request. To use it, simply add this module as an AxKit plugin that will be run before main AxKit processing is done.

  AxAddPlugin Apache::AxKit::StyleChooser::Hostname  

Then simply by referencing your xml files as follows:

   http://xml.server.com/myfile.xml

or

   http://www.server.com/myfile.xml

or whatever site aliases you have configured. In the above example, the two styles that will be used will be xml.server.com and server.com, respectively.

See the AxStyleName AxKit configuration directive for more information on how to setup named styles.

SEE ALSO

Top

AxKit.


Apache-AxKit-StyleChooser-Hostname documentation Contained in the Apache-AxKit-StyleChooser-Hostname distribution.

# $Id: Hostname.pm,v 1.3 2004/06/24 18:28:37 nachbaur Exp $

package Apache::AxKit::StyleChooser::Hostname;

use strict;
use Apache::Constants qw(OK);
our $VERSION = 0.01;

sub handler {
	my $r = shift;
	
	my $style = $r->hostname();

	if ($style && $style ne $r->server->server_hostname()) {
        $style =~ s/^www\.//; # trim off useless "www" prefix
		$r->notes('preferred_style', $style);
	}
	return OK;
}

1;
__END__