Path problem in perl

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amolbehl
    New Member
    • May 2007
    • 63

    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

    Code:
    /ABX/WebServer/CGI-Executables/ask/ttxcfg.cgi
    and the header.shtml is

    Code:
    /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
    Code:
     <IMG src="cgi-bin/ask/image.gif">
    but it did not appear. Can anyone help me with this.
  • Kelicula
    Recognized Expert New Member
    • Jul 2007
    • 176

    #2
    Originally posted by amolbehl
    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

    Code:
    /ABX/WebServer/CGI-Executables/ask/ttxcfg.cgi
    and the header.shtml is

    Code:
    /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
    Code:
     <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:
    [code=perl]

    # In the script to reach your template.
    my $temp = "../../../Documents/ttxdata/templates/header.shtml";

    [/code]

    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:

    [code=perl]
    <img src="../../WebServer/images/theImage.jpg">
    [/code]

    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??

    Comment

    • KevinADC
      Recognized Expert Specialist
      • Jan 2007
      • 4092

      #3
      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">

      Comment

      • KevinADC
        Recognized Expert Specialist
        • Jan 2007
        • 4092

        #4
        oops, we were posting at the same time kelicula, I would not have posted had I seen your good explanation already posted.

        Comment

        • Kelicula
          Recognized Expert New Member
          • Jul 2007
          • 176

          #5
          Originally posted by KevinADC
          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!!

          Comment

          Working...