Solved

calling DHTML to nested table within script?

Posted on 2000-05-09
4
234 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
  • 2
4 Comments
 
LVL 16

Accepted Solution

by:
maneshr earned 100 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

930 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now