?
Solved

calling DHTML to nested table within script?

Posted on 2000-05-09
4
Medium Priority
?
240 Views
Last Modified: 2013-12-25
Hi !

I have a dhtml script with image map & graphic.  It is rather lengthy. Rather that hardcode it into each of my multiple cgi scripts, I would like to keep it separate and have the cgi call it into a table cell.

Unfortunately, I am not so pro at cgi (I am editing a downloaded script) and am not sure of the best ways to (a) include the html and (b) escape or 'print' the html.

I have it defined thus:

   #Wel Map
   $welmap;
   open(FILE, "/welmap.html") || die print"please work";
   while(<FILE>){
   print "$_\n";
   }
   close (FILE);

and later called:

    <td width="125" rowspan="4" valign="top"         bgcolor="#ffffcc">$welmap</td>

This results in a 500 error. The entire welmap.html is

(1) dhtml/javascript/drill down menu;
(2) a table in and of itself;
(3) Successfully called in and used in SHTML

Nothing is escaped.  Oh yeah, and if I cut and paste the html from the welmap.html document directly into the cgi script (defining $welmap) it works fine.  So it's not something in the dhtml itself.  I just need to know how to call the .html file, and escape the html once it loads.

Is such a nested table compatible with Perl? And if so, can you *PLEASE* help me figure out how?

Thanks for your time!
0
Comment
Question by:celere
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 16

Accepted Solution

by:
maneshr earned 400 total points
ID: 2794297
instead of ...

#Wel Map
$welmap;
open(FILE, "/welmap.html") || die print"please work";
while(<FILE>){
print "$_\n";
}
close (FILE);

try this....

#Wel Map
undef $/;

open(FILE, "/welmap.html") || die print "please work";
## The next line reads the ENTIRE file into a variable.
$welmap=<FILE>;
close(FILE):
$/="\n";


So later when you call...


                        <td width="125" rowspan="4" valign="top"         bgcolor="#ffffcc">$welmap</td>

the $welmap variable will print the entire contents of the welmap.html file!!

0
 
LVL 6

Expert Comment

by:christopher sagayam
ID: 2795190
what is the full path to your cgi script ?

what is the full path to your "welmap.html" ?
0
 

Author Comment

by:celere
ID: 2797185
Interesting.

This works if the welmap.html file is in the same directory as the cgi script:

#Wel Map
undef $/;
open(FILE, "welmap.html")|| die print "please work";
## The next line reads the ENTIRE file into a variable.
$welmap=<FILE>;
close(FILE);
$/="\n";

But if I have the html file in the parent directory, both root relative and absolute refs fail. I can work with them in the same directory, but if anyone can enlighten me on why this is, I appreciate it.  Thanks!
0
 
LVL 16

Expert Comment

by:maneshr
ID: 2797377
check if the user under whom the CGI process runs (typically nobody) has read access to the directory/directories in question.

that looks like the most probable cause of your problem.
0

Featured Post

Basic Security of Your VPC

So, you’ve got this shiny new VPC and a fancy new application configured on your EC2 servers ready to go. This application is only accessible from your computer, which is great for security, but you need your users to be able to access it! So, what’s the easiest way to do this?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
The viewer will learn how to count occurrences of each item in an array.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question