Skip to main content.
home | support | download

Back to List Archive

Re: swish.cgi results no path in title

From: <moseley(at)not-real.hank.org>
Date: Mon Sep 15 2003 - 02:35:08 GMT
On Sun, Sep 14, 2003 at 05:33:36PM -0700, Aaron Bazar wrote:

> OK. I have a slightly tweaked CGI script... so, I started with the default
> swish.cgi that comes with the installation. It still did not work. I changed
> out my template.tmpl file with the one that came with the download... it
> still did not work. Then... I turned off "use_library"... in other words, I
> used the binary instead of the PERL API and It worked!

Ah, good.  I didn't know you were using the library so I didn't test 
with that.  That feature to show the path if the title doesn't exist is 
a swish-e binary feature only (it's in result_output.c which is not part 
of the library).

> ###MY CHANGE####
> if ($props{"swishtitle"} ==""){$props{"swishtitle"} ="Untitled"};
> 
> ###END MY CHANGE####

That's one way to do it.  My perl style is:

   $props{swishtitle} ||= 'Untitled';


I looked at the Template-Toolkit template and I see:

   [% ( item.swishtitle || item.swishdocpath )  %]

The swish-e binary does something like this, but uses the basename of 
the path as the title (which is probably better).   But the template is 
best place to do that kind of output formatting.

If you are using that template system you could write:

 [% ( item.swishtitle || 'Untitled' )  %]


But your way is fine.


-- 
Bill Moseley
moseley@hank.org
Received on Mon Sep 15 02:35:17 2003