grashoper has asked for the wisdom of the Perl Monks concerning the following question:

Here is my problem, I need to get this site to display the help in the left margin, O wise ones what is wrong with my code currently nothing is displayed in left margin under the help tab, where am I going wrong?
sub mLeftIndex if ($Request->item("Tab")->item() eq "Help") { my $content = '<leftIndex>'; if ( $Request->ServerVariables("SERVER_NAME")->item() =~ /mlxhelp/ + ) { my $toc_file = ( $Session->{'usrType'} eq 'Pro' ) ? 'c:\Suppor +tWeb\NerfHerder\Content\HELP\PRO\TOC.html' : 'c:\SupportWeb\NerfHerde +r\Content\HELP\STD\TOC.html'; my $user_type = uc $Session->{'usrType'}; open TOC, $toc_file; my @toc_lines = <TOC>; close TOC; foreach my $line ( @toc_lines ) { $content .= qq^<rlink tab="Help" script="frames['help_ifra +me'].location.href='Content/HELP/$user_type/$1'" title="$3"> </rlink>^ if ( $line =~ /<p class="pTOC1"><a href= +"(.*?)"\s+target="(.*?)">(.*?)<\/a>/ ); } $content .= '</leftIndex>'; } and subroutine for help tab is .. <code> sub tHelp { my $str = ""; $str .= mLeftIndex(); if ($Request->ServerVariables("SERVER_NAME")->item=~/mlxhelp/i) { my $target = ( $Session->{'usrType'} eq 'Pro' ) ? 'MLXchange%203.0%2 +0professional_frame' : 'MLXchange%203.0%20standard_frame'; my $startpoint = ( defined $Session->{'startPoint'} ) ? $Session->{'st +artPoint'} : ( $Session->{'usrType'} eq 'Pro' ? 'Content/HELP/PRO/Fra +meset.html' : 'Content/HELP/STD/Frameset.html' ); $str .= ($Request->ServerVariables("SERVER_NAME")->item() =~ /mlxhelp/ +i) ? shadowBox("MLXChange Help", qq^<help_iframe name="$target" start +point="$startpoint"/>^ , ($g_docWidth/5*4-(2*$g_docSpace))) : shadowB +ox("Tempo User", 'hello', ($g_docWidth/5*4-(2*$g_docSpace))); return $str; } else { my $target = ( $Session->{'usrType'} eq 'Pro' ) ? 'Tempo_help_f +rame' : 'Tempo_help_frame'; my $startpoint = ( defined $Session->{'startPoint'} ) ? $Session->{'st +artPoint'} : ( $Session->{'usrType'} eq 'Pro' ? 'Content/HELP/TPO/def +ault/Tempo_help-08-1.html' : 'Content/HELP/TPO/default/Tempo_help-08- +1.html' ); $str .= ($Request->ServerVariables("SERVER_NAME")->item() =~ /tempohel +p/i) ? shadowBox("Tempo Help", qq^<help_iframe name="Tempo_help_frame +" startpoint="$startpoint"/>^ , ($g_docWidth/5*4-(2*$g_docSpace))) : +shadowBox("Tempo User", 'hello', ($g_docWidth/5*4-(2*$g_docSpace))); return $str; } }

Replies are listed 'Best First'.
Re: need help file to display
by samtregar (Abbot) on Oct 08, 2007 at 19:53 UTC
    What kind of a system are you working on? It's tempting to think you're asking for HTML help, and some of your code does reference files ending in ".html". However, you've also got some non-HTML tags like <help_iframe> and <rlink>. I have no idea what those do - are they instructions for some kind of intermediate language?

    Quite aside from your concrete problem, your code is a terrible mess. You need to spend some quality time with Perl::Tidy. A read through Perl Best Practices would definitely be a good idea too!

    -sam

Re: need help file to display
by graff (Chancellor) on Oct 08, 2007 at 17:56 UTC
    There are some problems with the way you posted the code for the "mLeftIndex" subroutine -- missing curly braces and lines of code broken into two or more lines of text where they shouldn't be (including a " +" continuation marker as part of the line break).

    Have you checked the script for syntax errors? (run the command perl -T -cw your_script_filename

    Have you checked the web server's error log to see whether your script is generating error messages, and what those are?

    If the script you are actually running does not contain syntax errors, and if it is not emitting error messages to the server log, please try updating your post with a cleaner and more faithful rendering of the code in question. (Fixing indentation would be a real help as well.)

Re: need help file to display
by dwm042 (Priest) on Oct 08, 2007 at 18:37 UTC
    If the idea is to use tables for page layout, then I would strongly suggest looking at the site A List Apart. They have some excellent articles on web page design, including this one. They also have pages that discuss the sliding doors technique, which is one of the more popular ways to tab pages these days.

    David.
A reply falls below the community's threshold of quality. You may see it by logging in.