Solved

calling DHTML to nested table within script?

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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…
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to dynamically set the form action using jQuery.

696 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