|
From: barry <sla...@i1...> - 2001-10-31 23:59:59
|
In case other people want to know what section their template is being
called from, within the template -
I haven't finished integrating this into my templates yet, but it looks
like I need to make the following changes to implement Jason's suggestion:
1 - in index.pl:
I need to add the last parameter to this SlashDisplay call:
slashDisplay('index', {
is_moderator => scalar
$slashdb->checkForMetaModerator($user),
stories => $Stories,
boxes => $StandardBlocks,
section => $section,
});
this makes the section hash know to the index* templates. Note that the
section key does not exist for the default section, so you will have to
test for its existence in the template if that matters to you
2 - in my case I want to have section specific changes in the header*
template too.
so in Slash.pm (sub header) I changed this call:
if ($section){
my $sectionInfo = getSection($form->{section});
slashDisplay('header',
{section=> $sectionInfo},
);
else {
slashDisplay('header'); #original line
}
and back in index.pl/main I changed the call to header() to:
header($title, $section->{section});
I haven't really checked to see if header() is used anywhere else, but I
think the if statement should keep it from breaking if it is.
3- within the templates, I have this code to test the availablity of the
section hash:
1234567
[% FOREACH key = section.keys %]
- [% key %] => [% section.$key %] -
[% END %]
Hope this helps.
Barry
-------------------------------------------
If I do:
[% section.section %]
I get a null value
but if I do
[% section %]
I get a hash identifier.
Is this hash always available or do I need to initialize it in some way?
Thanks!
Barry
At 02:32 PM 10/31/2001 -0500, Jason Huckaby wrote:
>I've used this:
>
>[% IF section.section == 'foo' %]
>
>your stuff here
>
>[% END # if section %]
>
>barry wrote:
> >
> > in a template, is there a variable or some other way to know what section
> > is currently active?
>
>
>-jh
>
>--
>Jason Huckaby
>
>NErock.com Webmaster
>Portland, ME
>(207) 415-3142
>
>_______________________________________________
>Slashcode-general mailing list
>Sla...@li...
>https://lists.sourceforge.net/lists/listinfo/slashcode-general
_______________________________________________
Slashcode-general mailing list
Sla...@li...
https://lists.sourceforge.net/lists/listinfo/slashcode-general
|