By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,847 Members | 1,326 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,847 IT Pros & Developers. It's quick & easy.

Path problem in perl

P: 63
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
Share this Question
Share on Google+
4 Replies


Kelicula
Expert 100+
P: 176
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
Expert 2.5K+
P: 4,059
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
Expert 2.5K+
P: 4,059
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
Expert 100+
P: 176
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

Post your reply

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