mkenney has asked for the wisdom of the Perl Monks concerning the following question:

I'm hitting my head against the wall over something I know is simple, HELP!

I have my HTML::Template code and PERL code in the directory: /apache/cgi-bin/application

Any images or CSS are looked for by the browser in: /apache/htdocs

The editor is looking for them in the first directory. There has to be a way to make them both look in the same place.

If I'm editing an HTML document in the /apache/cgi-bin/application directory it puts a bunch of junk in the link at either works in the editor or the web-browser verision so only works at a time. I'm sure I'm going about this the wrong way, maybe I need full links in my PERL code but the ln -s has made it much easier to prototype changes.

HELP!

2004-11-27 Edited by Arunbear: Changed title from 'Missing something simple...', as per Monastery guidelines

  • Comment on Problems when using HTML editor on HTML::Template's

Replies are listed 'Best First'.
Re: Problems when using HTML editor on HTML::Template's
by rupesh (Hermit) on Nov 24, 2004 at 04:58 UTC

    I'm not sure I can understand what you want either, but here's an advise.
    While CGI Scripting, ALWAYS use the relative path and NEVER the absolute path when pointing to a file/html/image etc.

    So, you would code cgi-bin/script.pl from a HTML page in /apache/htdocs rather than /apache/cgi-bin/script.pl

    Rupesh.

      While CGI Scripting, ALWAYS use the relative path and NEVER the absolute path when pointing to

      Is there a reason for this recommendation ?

      Update: I guess you are hoping the editor will just use the relative links and do the right thing. Might work depending on the editor.

Re: Problems when using HTML editor on HTML::Template's
by data64 (Chaplain) on Nov 24, 2004 at 04:41 UTC

    What editor is this ? Also, I do not completely understand what you are saying/asking in your last para.

Re: Problems when using HTML editor on HTML::Template's
by nedals (Deacon) on Nov 24, 2004 at 06:31 UTC

    Your question is somewhat confusing, but here goes anyway..

    In your HTML doc (the one that's returned by the script maybe) use..
    <link rel="stylesheet" type="text/css" href="/style.css">
    <img src="/images/img.gif">
    <a href="/cgi-bin/script.cgi">

    The starting '/' will begin the path in the 'htdocs' directory

    Within your script, you should use the full path to get to your .tmpl file
    My guess is that you need more than "/apache/cgi-bin/application/".

    Probably something like this..
    "/usr/local/apache/cgi-bin/application/thetemplatefile.tmpl"

Re: Problems when using HTML editor on HTML::Template's
by DrHyde (Prior) on Nov 24, 2004 at 09:39 UTC
    Downvoted, for the following reasons:
    • Question is hard to understand;
    • Title is not at all helpful;
    • It's spelt perl or Perl, never PERL;
    • Question appears to not in fact be about perl, but about Apache configuration. Or maybe how to use an editor. Or maybe how to use ln. It's kinda hard to tell.