Gossamer Forum
Home : Products : Links 2.0 : Discussions :

Different 'Titles' for each category

Quote Reply
Different 'Titles' for each category
Hi,
It's me again.

I am trying to get a different web page title for each category for the detailed pages and have tried lots of different codes but I am stuck.

I am using site_html.pl and at the top I have created variables to use throughout the program as follows:-

$site_title = "Garden Sheds, Summer & Leisure Buildings, Log Cabins, Playhouses, Greenhouse, Conservatories & Shed Plans";
$site_sheds_title_usa = "Garden Sheds-Summer Buildings-Log Cabins-USA America ";
$site_sheds_title_gb = "Garden Sheds-Summer Buildings-Log Cabins-UK Great Britain N Ireland ";
$site_sheds_title_canada = "Garden Sheds-Summer Buildings-Log Cabins-Canada ";

I then go to the create detailed pages:-

##########################################################
## Detailed View ##
##########################################################
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.
#


and for the Title I have changed this to the following:-

<title>~;
if ({$category_name eq "United-States"}) { $output .= qq~ $site_sheds_title_usa ~; }
if ({$category_name eq "Great_Britain"}) { $output .= qq~ $site_sheds_title_gb ~; }
if ({$category_name eq "Canada"}) { $output .= qq~ $site_sheds_title_canada ~; }
$output .=qq~</title>

What I want is when the detailed page is a United-States category it uses $site_sheds_title_usa and when it is Great_Britain it used $site_sheds_title_gb etc.

What it does is adds all the above in the Title as follows:-

<head>
<title> Garden Sheds-Summer Buildings-Log Cabins-USA America Garden Sheds-Summer Buildings-Log Cabins-UK Great Britain N Ireland Garden Sheds-Summer Buildings-Log Cabins-Canada </title>

Is there a way so that it can select just the title for each category?

My website is http://www.gardenbuildings.com/directory/

Thanks in advance.

Regards,
Robin
Quote Reply
Re: [robinantill] Different 'Titles' for each category In reply to
Question: How does it know which category is which?
Quote:
What I want is when the detailed page is a United-States category it uses $site_sheds_title_usa and when it is Great_Britain it used $site_sheds_title_gb etc.


You could try this:

if ($category_name eq "United-States") { $output .= qq~ $site_sheds_title_usa ~; }

--removed the {curly brackets}.

Then change the other two 'if' statements to 'elsif'

Or, maybe...

if (($rec{'Category'}) eq "United-States") { $output .= qq~ $site_sheds_title_usa ~; }


Just a couple of quick ideas.


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] Different 'Titles' for each category In reply to
Hi Leonard,
That works really great, thank you very much it is appreciated. For the record this is what I did:-

<title>~;
if (($rec{'Category'}) eq "United-States") { $output .= qq~ $site_sheds_title_usa $rec{'Title'} ~; }
if (($rec{'Category'}) eq "Great_Britain") { $output .= qq~ $site_sheds_title_gb $rec{'Title'} ~; }
if (($rec{'Category'}) eq "Canada") { $output .= qq~ $site_sheds_title_canada $rec{'Title'} ~; }
if (($rec{'Category'}) eq "Other_Areas") { $output .= qq~ $site_sheds_title_other $rec{'Title'} ~; }
$output .=qq~</title>

Thanks again,
Robin