1 package Catalyst::View::TT::XHTML;
4 use base qw/Catalyst::View::TT/;
6 our $VERSION = '1.000';
11 $self->next::method(@_);
12 my $accept = $c->request->header('Accept');
13 if ( $accept && $accept =~ m|application/xhtml\+xml|) {
14 $c->response->headers->{'content-type'} =~ s|text/html|application/xhtml+xml|;
25 Catalyst::View::TT::XHTML - A sub-class of the standard TT view which
26 serves application/xhtml+xml content if the browser accepts it.
30 package MyApp::View::XHTML;
33 use base qw/Catalyst::View::TT::XHTML MyApp::View::TT/;
39 This is a very simple sub-class of L<Catalyst::View::TT>, which sets
40 the response C<Content-Type> to be C<application/xhtml+xml> if the
41 user's browser sends an C<Accept> header indicating that it is willing
42 to process that MIME type.
44 Changing the C<Content-Type> causes browsers to interpret the page as
45 strict XHTML, meaning that the markup must be well formed.
47 This is useful when you're developing your application, as you know that
48 all pages you view are rendered strictly, so any markup errors will show
55 Overrides the standard process method, delegating to L<Catalyst::View::TT>
56 to render the template, and then changing the response C<Content-Type> if
57 appropriate (from the requests C<Accept> header).
61 There should be a more elegant way to inherit the config of your normal
64 Configuration (as loaded by L<Catalyst::Plugin::ConfigLoader>) for the TT
67 No helper to generate the view file needed (just copy the code in the
72 Tomas Doran C<< <bobtfish@bobtfish.net> >>
78 =item David Dorward - test patches
84 This module itself is copyright (c) 2008 Tomas Doran and is licensed under the same terms as Perl itself.