Fellow Monasterians:
This is probably more of a fundamental question about paths than pure Perl, but bear with me.
I'm trying to move common code used by several Web sites on the same host to a common area and share it. I've got most of the paths correct, but the links in the html (HTML::Template .tmpl files) aren't working. If I were using CGI::Application it's easier for me to understand from where the instance was called and trace the paths back that way. But I'm not using it on this (too much legacy code to convert at the moment). Here's the deal:
var/www/-----+
|
/admin-------+
| |
| login.pl
|
/templates-----+
| |
| admin.tmpl
| |
| /images-----+
| |
| save_btn.gif
|
/domain1-----+
| |
| admin -> /var/www/admin (symlink)
|
/domain2-----+
| |
| admin -> /var/www/admin
|
etc.
Setup:
- vhost is pointing to /var/www/domain1
- http://www.domain1.com/admin/login.pl successfully pulls up:
- my $template = HTML::Template->new( filename => '../templates/login.tmpl' );
- login.tmpl contains <img src="images/save_btn.gif" />
Problem:
- No image is displayed
- Broken link shows: http://www.domain1.com/admin/images/save_btn.gif
- If I move the /images under /admin (see below), no joy
/admin-------+
| |
| login.pl
| |
| /images-----+
| |
| save_btn.gif
- If I enter http://www.domain1.com/admin/images/save_btn.gif in the address field of my browser, Firefox just shows the URI, and no image.
- If I move the /images under /domain1 and use <img src="http://www.domain1.com/images/save_btn.gif" /> the image appears! But that defeats the purpose of my goal of using coming code and files.
/domain1------+
| |
| /images-----+
| |
| save_btn.gif
Question: where do I put those common images and what do my .tmpl image paths need to look like to share the image and still have them appear? Thanks in advance.
—Brad
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.