Solved

calling DHTML to nested table within script?

Posted on 2000-05-09
4
232 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
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 …
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

705 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

20 Experts available now in Live!

Get 1:1 Help Now