Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Multiple Detail page mod?

Quote Reply
Multiple Detail page mod?
I've spent many hours following threads regarding this topic and can't find anything that matches my needs and it doesn't look too hard, but programming isn't my strong suite. I think I just need a few pointers in the right direction - if someone could be so kind.

Here's the need.
I am working on a city business directory. I want to be able to have different detail templates to choose from.

Example:
Main Detail Page - most features (detailed.html)
Basic Detail Page - minimum features (basic.html)
(later on...)
Movie Detail Page - for current movie listings (movie.html)

My Solution so far:

I've also used the multiple category mod from bobsie for multiple category templates, so I'm trying to follow the same format to create my detail page templates.

1) I've modified links.def to include a new field called 'isBasic' and chosen it to be a select field of 'Yes' or 'No'. (Might change it later to be more appropriate for extra templates to something like 'DetailType' and have select fields like 'Detailed', 'Basic', & 'Movie'.)

2) Modified Site_Html_Templates.pl to this.

sub site_html_detailed {
# --------------------------------------------------------
# This routine will build a single page per link. It's only
# really useful if you have a long review for each link --
# or more information then can be displayed in a summary.
#
my %rec = @_;

#detailed page mod - vx

my $template;

# Set the appropriate detail page to load
if ($isBasic eq 'Yes') {
$template = "basic.html"; }
else { $template = "detailed.html"; }

#End detailed page mod - vx

return &load_template ( $template, {

...etc...
=========================================================
=========================================================

Unfortuantely as it is the pages all used 'detailed.html' templates no matter if 'Yes' was selected or not.
If I changed the 'eq' in the formula to '=' as it is below then all the pages came out as basic.html pages.
if ($isBasic = 'Yes') {

Would anyone be able to tell me the proper syntax for this problem? Am I working in the right direction?

Good judgment comes from experience, and experience comes from bad judgment. -- Barry LePatner
Quote Reply
Re: Multiple Detail page mod? In reply to
$isBasic doesn't exist.

You need:

Code:
if ($rec{'isBasic'} eq 'Yes') {
$template = "basic.html"; }
else {
$template = "detailed.html";
}
Installs:http://wiredon.net/gt
FAQ:http://www.perlmad.com

Quote Reply
Re: Multiple Detail page mod? In reply to
Thank you! It worked great!
I've gone ahead and modified links.def and site_html_templates.pl to accept the basic & movie templates, and they work great as well.

Here is the working example for any others interested in doing this as well.

sub site_html_detailed {
# --------------------------------------------------------
# This routine will build a single page per link. It's only
# really useful if you have a long review for each link --
# or more information then can be displayed in a summary.
#
my %rec = @_;

#detailed page mod - vx

my $template;

# Set the appropriate detail page to load

if ($rec{'DetailType'} eq 'Basic') {
$template = "basic.html"; }
elsif ($rec{'DetailType'} eq 'Movie') {
$template = "movie.html"; }
else {
$template = "detailed.html";
}

#End detailed page mod

return &load_template ( $template, {
total => $total,
grand_total => $grand_total,
category_name => $category_name,
category_name_escaped => $category_name_escaped,
category_clean => $category_clean,
title_linked => $title_linked,
%rec,
%globals
} );
}

I really appreciate your help.

Good judgment comes from experience, and experience comes from bad judgment. -- Barry LePatner