I am trying to input a switch so that I can add content to a page on my dbdriven website, however I can't seem to get it right today here is the code, this is using a heredoc to output and using an xslt
sub mLeftIndex
{
my $str = ""; #Sets content to blank
my $logoutLink = "<link tab=\"\" view=\"Logout\" title=\"Logout\"/
+>"; #Generates Logout link#
SWITCH:
{
if (($Request->item("Tab")->item() eq "Support") and ($selected
+="CTS"))
{
# Inserts leftIndex tag for document #
#$xml = qq^<leftIndex>^;
#sets menuitem for left hand side #
$xml.=qq^
<link tab="Support" view="ClassOutlines" title="Course Outlines
+">
<description>Outlines for CTMLS Courses</description>
<header>0</header>
</link>;
^;
#closes menuitem and closing leftIndex tag here #
$xml=qq^
</leftIndex>
^;
#patternmatch stuff for here document..
if (!$Request->item("View")->item() && $xml =~ /(.*?)<link tab
+=\"Support\" view=\"Search\" .*?<\/link>(.*)/s)
{
$xml = $1.$2;
}
$xml =~ s/(<\/leftIndex>)/$logoutLink$1/s;
$str .= $xml;
}
# other content for support tab #
if ($Request->item("Tab")->item() eq "Support")
{
my $xml =qq^
<leftIndex>
^;
$xml .= qq^
<link tab="Support" view="Search" title="Search">
<description>Search our Help Articles</description>
<header>0</header>
</link>
<link tab="Support" view="HowTo" title="How To Use MLXchange">
<description>Walkthroughs for common tasks using MLXchange</descri
+ption>
<header>0</header>
</link>
<link tab="Support" view="Tutorials" title="MLXchange Tutorials">
<description>Tutorials and Demos showing you how to use MLXchange<
+/description>
<header>0</header>
</link>^ if ( $Request->ServerVariables("SERVER_NAME")->item() =~ /m
+lxhelp/i );
$xml .= qq^
<link tab="Support" view="PCMaint" title="PC Maintenance">
<description>Some Helpful tips for maintaining your PC</descriptio
+n>
<header>0</header>
</link>
^;
$xml .=qq^
<link tab="Support" view="Tempotutorials" title="Tempo Tutorials">
<description>Tempo Tutorials</description>
<header>0</header>
</link>
<link tab="Support" view="TManuals" title="Tempo UserGuide">
<description>Tempo UserGuide</description>
<header>0</header>
</link>^ if ($Request->ServerVariables("SERVER_NAME")->item()=~/tempoh
+elp/i);
$xml .= qq^
<link tab="Support" view="Manuals" title="MLXchange Manuals">
<description>Documentation of MLXchange Software</description>
<header>0</header>
</link>
<link tab="Support" view="FAQ" title="Frequently Asked Questions">
<description>Answers to the Most Common Questions</description>
<header>0</header>
</link>
^ if ( $Request->ServerVariables("SERVER_NAME")->item() =~ /mlxhelp/i
+);
$xml .= qq^
</leftIndex>
^;
if (!$Request->item("View")->item() && $xml =~ /(.*?)<link tab
+=\"Support\" view=\"Search\" .*?<\/link>(.*)/s)
{
$xml = $1.$2;
}
$xml =~ s/(<\/leftIndex>)/$logoutLink$1/s;
$str .= $xml;
last SWITCH;
}
I get following error when I try to run this.
Error Code: -1072896659
Reason: End tag 'leftIndex' does not match the start tag 'body'.
Line: 2820