Skip to main content.
home | support | download

Back to List Archive

Re: [swish-e] Using more than one template

From: Bill Moseley <moseley(at)>
Date: Sat Jun 16 2007 - 17:13:56 GMT
On Sat, Jun 16, 2007 at 01:00:56PM +0200, Kake Lol wrote:
> > If it's just the layout you want to be different you can use a wrapper
> > template to look at that query parameter and select which layout you
> > want.
> >
> >     layout = ( get the template value )
> <snip>
> How do I fetch the template value? And do i still need 'file =>
> '',' in my config?

That's up to you.  There's not set way -- it's something you need to
code yourself.

How do you want to select different layouts?  By host name?  By path?

Look at the SWISH::TemplateToolkit module:

    my $vars = {
        search  => $subclass,
        CGI     => $results->CGI,

So the template is passed the "search" object (I don't remember what's
in there), and the CGI object.  You can inspect those by editing a
template and adding:

    [% USE Dumper; Dumper.dump( search ) | stderr %]

to dump the search object to your error log.

(Of course, you could also:
    use Data::Dumper;
    warn Dumper $subclass;
in the file)

Then look for something you can use to determine which layout to use.

Or even do something like:

    my $vars = {
        search  => $subclass,
        CGI     => $results->CGI,
        layout  => $layout,

where you have set $layout based on something code.

If you are planning on a lot of customization look at the search.cgi
script, too.  It's quite a bit leaner and probably easier to

Bill Moseley

Unsubscribe from or help with the swish-e list:

Help with Swish-e:

Users mailing list
Received on Sat Jun 16 13:13:57 2007