Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: How do I make a shortcut to dynamic file

by naikonta (Curate)
on Nov 14, 2007 at 01:17 UTC ( #650645=note: print w/ replies, xml ) Need Help??


in reply to How do I make a shortcut to dynamic file

I am looking for suggestions on how to solve this problem
Oh, and what about the same problem you posted the other day? Could you at least please show what you have tried?

Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!


Comment on Re: How do I make a shortcut to dynamic file
Re^2: How do I make a shortcut to dynamic file
by grashoper (Monk) on Nov 14, 2007 at 05:48 UTC
    Thanks to help from here & some reading I did on my own I finally figured out how to pass the value to my subroutine as posted in node 650104 however I was quite surprised to discover after passing the value of the topic I wanted to make the startpoint in my hash it wouldn't work because the file itself is being parsed via a loop and written out to mLeftIndex, so I realize now that I cannot simply shortcut into the content since it doesn't exist at that point. I have requested an xml copy of the file and will try to parse the xml file to obtain the desired result. statically coding the startpoint works but when I try to pass it as a variable I get a blank page, when I redirect to $baseurl, it still doesn't work as desired and again I get a blank page, unless I leave the hardcoded value of startpoint, this is kind of odd as I can do a $response->write and wala there is the correct value for startpoint in the window, so I am rather frustrated as I see it I have 4 options, 1 try it with the xml file which at least I could add a tag for my "topic" and display it if there is a match or , 2 create a new sub and a new loop to try it with the desired content file. 3. create snapshot files and open them based on topic lookup. 4. I am sure there is more than one way to do it. here is my previous node.. grashoper has asked for the wisdom of the Perl Monks concerning the following question: I need to pass a string to a subroutine but cannot seem to get it to work, here is some sample of what I mean. snippet one is preauth file (pass thru authenticaton) topic obtained from querystring and passed to sub thelp (Hopefully result) which is not working for me. code for sub tHelp follows code snippet from preauth, in addition there is a loop in mLeftIndex() which creates the help file, I am attempting to modify the startpoint of the file..
    $User = $Request->item("Login")->item(); $Site = $Request->item("Site")->item(); $topic= $Request->item("Topic")->item(); my $Referer = $Request->ServerVariables("HTTP_REFERER")->item(); $Request->ServerVariables("QUERY_STRING")->item(); use CGI; use OLE; use CGI::Simple; $query= new CGI; %ttopics = ( home => 'Content/HELP/TPO\/default\//TEMPO 5 Help Topics +-01-1.html', listingmgr => 'Content/HELP/TPO\/default\//TEMPO 5 Help Topics +-06-1.html', cma => 'Content/HELP/TPO\/default\//TEMPO 5 Help Topics +-11-1.html', hotsheetmgr => 'Content/HELP/TPO\/default\//TEMPO 5 Help Topics +-10-1.html', clientmgr => 'Content/HELP/TPO\/default\//TEMPO 5 Help Topics +-05-1.html', tempofinancials => 'Content/HELP/TPO\/default\//TEMPO 5 Help Topics +-14-1.html', tools => 'Content/HELP/TPO\/default\//TEMPO 5 Help Topics +-18-1.html', rep => 'Content/HELP/TPO\/default\//TEMPO 5 Help Topics +-12-01.html', taxmgr => 'Content/HELP/TPO\/default\//TEMPO 5 Help Topics +-13-1.html', TempoMemberInfo => 'Content/HELP/TPO\/default\//Tempo_help-01-1.htm +l', email => 'Content/HELP/TPO\/default\//Tempo_help-01-1.htm +l', ); if (!defined($topic)) { my $startpoint='Content/HELP/TPO/default/Tempo_help-08-1.html'; } my $baseurl='http://www.tempohelp.com/index.asp?tab=Help&View=#'; $nightmare = $ttopics{$topic}; my @topicvalues=$nightmare; my @baseurl=$baseurl; tHelp(@baseurl,@topicvalues);
    tHelp
    sub tHelp { $baseurl=shift(@baseurl); $startpoint=shift(@topicvalues); $Response->write("$baseurl"."$startpoint"); # This returns values for baseurl and startpoint so far so #good then deeper in my sub when I go to use startpoint it does not work why +? if ($Session->{'usrType'} eq 'Std') { if ($Request->ServerVariables("SERVER_NAME")->item()=~/tempohelp/i +) { $startpoint=shift(@topicvalues); $baseurl=shift(@baseurl); #my startpoint='Content/HELP/TPO/default/Tempo_help-08-1.html'; my $target='Tempo%20help_frame'; $str .= shadowBox("Tempo Help", qq^<help_iframe name="$target" startpo +int="$startpoint"/>^ , ($g_docWidth/5*4-(2*$g_docSpace))); return $str; } } finally code for loop to generate helpfile into iframe. if ( $Request->ServerVariables("SERVER_NAME")->item() =~ /tempohelp/ ) + { my $toc_file = ( $Session->{'usrType'} eq 'Pro' ) ? 'e:\Suppor +tWeb\Content\HELP\PRO\TOC.html' : 'e:\SupportWeb\Content\help\tpo\def +ault\TOC.html'; my $user_type = uc $Session->{'usrType'}; if ($user_type='STD') {$user_type='TPO/default/'} 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="pTOC\d"><a +href="(.*?)"\s+target="(.*?)">(.*?)<\/a>/ ); } $content .= '</leftIndex>'; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://650645]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2014-08-02 06:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (55 votes), past polls