Skip to main content.
home | support | download

Back to List Archive

Adding new drop downs to TemplateHTMLTemplate.pl

From: David Fishburn <fishburn(at)not-real.ianywhere.com>
Date: Thu Dec 11 2003 - 19:22:44 GMT
Versions:
Linux fishburn-RH9 2.4.20-20.9 #1 Mon Aug 18 11:45:58 EDT 2003 i686 i686
i386 GNU/Linux
SWISH-E 2.4.0
This is perl, v5.8.0 built for i386-linux-thread-multi
(with 1 registered patch, see perl -V for more detail)

Bill just recently made a patch for me to correctly display the
select_by_meta fields using the LIMITS section in the swish.tmpl.

I wanted to add another drop down, called Language.

I am not having any success adding this new drop down, so I was hoping
someone could give me some tips.

First, in swish.tmpl
I added this section (just before the LIMITS one):
            <tr>
            <TMPL_IF LANGUAGES>
                <br>
                <td>
                Getting closer to languages
                <TMPL_VAR LANGUAGE_TITLE>
                </td>
                <td>
                <select name="metaname">
                    <TMPL_LOOP LANGUAGES>
                        <option  value="<TMPL_VAR NAME>" ><TMPL_VAR
LABEL></opti
>>on>
                    </TMPL_LOOP>
                </select>
                </td>
            </TMPL_IF>
            </tr>


Next, in my /var/www/cgi-bin/.swishcgi.conf I added (just before the
select_by_meta tags):
        language_by_meta  => {
            #method     => 'radio_group',  # pick: radio_group, popup_menu,
or c
>>heckbox_group
            #method     => 'checkbox_group',
            method      => 'popup_menu',
            columns     => 3,
            metaname    => 'ami_language',     # Can't be a metaname used
elsewh
>>ere!
            # Use the array from channel_hash.pl which was generated
            # from the MySQL database
            values      => \@language,
            # Use the hash from channel_hash.pl which was generated
            # from the MySQL database
            labels      => \%language,
            description => 'Choose Language: ',
        },

Next, in my /usr/lib/swish-e/perl/SWISH/TemplateHTMLTemplate.pm
I cloned the LIMITS/Limits section and changed its name:
    # Language Select
    my $Language = $results->config('language_by_meta');
    if ( $Language ) {
        $params->{LIMIT_TITLE} = $Language->{description} || 'Choose
Language';
        my $labels = $Language->{labels} || {};

        $params->{LIMITS} = [ map { { VALUE => $_, LABEL => ($labels->{$_}
|| $_
>>) } } @{$Language->{values}} ] if $Language;
    }


This never results is anything additional being displayed to the search
page.
I wasn't sure where these 2 items get populdated/defined:
        $params->{LIMIT_TITLE} 
        $params->{LIMITS}

TIA for any advice.

Dave
Received on Thu Dec 11 19:23:21 2003