473,386 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Path problem in perl

Ok I have a small problem ... let me try to explain it.

I am to put apply these styles and images to a page. The page uses a template called header.shtml.
In the header.shtml I included a number of styles sheets as css files and images.

Now I need to set the path.
The path from root of the script which is loaded to browser is

Expand|Select|Wrap|Line Numbers
  1. /ABX/WebServer/CGI-Executables/ask/ttxcfg.cgi
and the header.shtml is

Expand|Select|Wrap|Line Numbers
  1. /ABX/WebServer/Documents/ttxdata/templates/header.shtml
Now I put the images in both those location i.e templates and ask directory with permission 755 but they are not getting displayed.

I assumed the document root is cgi-bin and tried image tag
Expand|Select|Wrap|Line Numbers
  1.  <IMG src="cgi-bin/ask/image.gif"> 
but it did not appear. Can anyone help me with this.
Feb 14 '08 #1
4 1236
Kelicula
176 Expert 100+
Ok I have a small problem ... let me try to explain it.

I am to put apply these styles and images to a page. The page uses a template called header.shtml.
In the header.shtml I included a number of styles sheets as css files and images.

Now I need to set the path.
The path from root of the script which is loaded to browser is

Expand|Select|Wrap|Line Numbers
  1. /ABX/WebServer/CGI-Executables/ask/ttxcfg.cgi
and the header.shtml is

Expand|Select|Wrap|Line Numbers
  1. /ABX/WebServer/Documents/ttxdata/templates/header.shtml
Now I put the images in both those location i.e templates and ask directory with permission 755 but they are not getting displayed.

I assumed the document root is cgi-bin and tried image tag
Expand|Select|Wrap|Line Numbers
  1.  <IMG src="cgi-bin/ask/image.gif"> 
but it did not appear. Can anyone help me with this.
In the Apache server, images, and text/html, files are NOT displayed from a executable directory. You will have to place them, in a separate folder down from the root.

From the cgi folder you mentioned you will have to go "up" three and then down four to reach the template from the cgi script. If the pages are being generated by the CGI script you will have to construct you paths relative to there.

ie:
Expand|Select|Wrap|Line Numbers
  1.  
  2. # In the script to reach your template.
  3. my $temp = "../../../Documents/ttxdata/templates/header.shtml";
  4.  
  5.  
However you can store the templates in the cgi directory, as long as they will only be accessed by your cgi scripts. BUT the images, css, etc... will have to still be up out of the executable directory. So in your templates you will have to list the path to an image as:
<img src="../../" > Now you will be in the WebServer dir, so wherever the image folder is go to that. (if it was one dir down in a folder called "images" it would be:

Expand|Select|Wrap|Line Numbers
  1. <img src="../../WebServer/images/theImage.jpg">
  2.  
The pages are acually being "served" from the cgi dir.

Hope this helps!!

It's kinda confusion, without me knowing where the css, and images are at.
I recommend making a sub folder in the CGI-Executables for the templates.

Unless (I noticed you have named them with shtml) you are using server side includes.

Let me know if this cleared things up at all??
Feb 14 '08 #2
KevinADC
4,059 Expert 2GB
are your images in the cgi-bin? If they are you have to move them out of the cgi-bin, it will block access to all files except CGI scripts. Put them in a folder below your root web folder.

Example:

www <-- root web folder
www/images <-- images in image folder

<img src="images/frog.gif">
Feb 14 '08 #3
KevinADC
4,059 Expert 2GB
oops, we were posting at the same time kelicula, I would not have posted had I seen your good explanation already posted.
Feb 14 '08 #4
Kelicula
176 Expert 100+
oops, we were posting at the same time kelicula, I would not have posted had I seen your good explanation already posted.
No problem, actually I think you accomplished it with less words!!
Feb 15 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

31
by: John Roth | last post by:
I'm adding a thread for comments on Gerrit Holl's pre-pep, which can be found here: http://tinyurl.com/2578q Frankly, I like the idea. It's about time that all of the file and directory stuff...
4
by: Sherman Willden | last post by:
I am trying to use Perl's XML::Twig to modify a version number in an XML document. At the very end of this posting is an excerpt from the xml document. Just before the xml excerpt is the Perl code...
12
by: Xah Lee | last post by:
Python Doc Problem Example Quote from: http://docs.python.org/lib/module-os.path.html ---------- split( path) Split the pathname path into a pair, (head, tail) where tail is the last...
3
by: Xah Lee | last post by:
Split File Fullpath Into Parts Xah Lee, 20051016 Often, we are given a file fullpath and we need to split it into the directory name and file name. The file name is often split into a core...
2
by: Julie Warden | last post by:
Group, I'm setting up Perl 5.8 on a Sun solaris 5.6 machine and have a question about the $PATH variable. My installation is in /usr/local with subdirs: perl is in bin libraries are in...
3
by: placid | last post by:
Hi All, I have these files; which are Merge Request (ClearCase) files that are created by a Perl CGI script (being re-written in Python, as the HTML/ JavaScript have been mixed with Perl,...
9
by: LuckyLeprechaun | last post by:
OS using: Linux(core 1), Solaris (5.6 to 5.8), Unix Perl version: v5.8.5 I need to find the path or alias that the user used to execute the program with (aka $0), just like the built-in shell...
1
by: hamidashrafi | last post by:
Hi, I just joined to the world of Perl. I am using the Open Perl IDE. in the following script do you know how I can set the path so, the program understand from where is should open the file....
10
by: anklos | last post by:
Hi, everyone~ I met a problem: the defualt java version on the unix sever is 1.4, but I'd like to export the 1.6 version on the sever (the 1.6 java exists on the sever) I wrote the code like...
3
by: anklos | last post by:
Hi, erveryone. The default lib path on my perl builder is "c:/perl/lib". Recently, I install the WordNet-Similarity-2.05 and run the makefile in it, then run the following command: make make...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.