grashoper has asked for the wisdom of the Perl Monks concerning the following question:
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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: outputting xml
by almut (Canon) on May 08, 2008 at 00:31 UTC | |
|
Re: outputting xml
by GrandFather (Saint) on May 08, 2008 at 02:10 UTC | |
|
Re: outputting xml
by pc88mxer (Vicar) on May 08, 2008 at 04:43 UTC | |
|
Re: outputting xml
by CountZero (Bishop) on May 08, 2008 at 09:11 UTC |