Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Question about web trees, html paths, and HTML::Template

by nedals (Deacon)
on Apr 06, 2008 at 03:02 UTC ( [id://678591]=note: print w/replies, xml ) Need Help??


in reply to Question about web trees, html paths, and HTML::Template

Only the files in domain1 and domain2 directories (and sub-directories) are web-accessible.
Your template files are reached via a full server path and can be accessed from multiple domains (on the same server).

One solution is to create a 3rd domain and put your common images, css, javascript, etc,. in that domain.
You would then need to use 'http://www.domain3/......' to access these files
(or you could put them all in something like 'http://www.domain1/common/....)

  • Comment on Re: Question about web trees, html paths, and HTML::Template

Replies are listed 'Best First'.
Re^2: Question about web trees, html paths, and HTML::Template
by bradcathey (Prior) on Apr 06, 2008 at 12:28 UTC
    Only the files in domain1 and domain2 directories (and sub-directories) are web-accessible.

    Sheesh, I can't believe I didn't know that. Okay, that's a great concept to keep in mind as I foray into the webhosting realm.

    I don't lose that much by keeping common images in each domain, as they never change, or if they do it's only for that domain. What still works is to have all domains using the same Perl and templates so, for example, instead of upgrading a Perl script in each of the domains, I only change it in one place.

    Perfect. Thanks all!

    —Brad
    "The important work of moving the world forward does not wait to be done by perfect men." George Eliot
      I don't lose that much by keeping common images in each domain, as they never change, or if they do it's only for that domain.

      You can use vhosts and still do the "shared image directory" thing by symlinking your image directory into each vhost's document tree, assuming this is on a unix-type system. (See man ln if you're not familiar with it already.)

        Brilliant. I hadn't thought of that. And yes, this is Debian 4.x so no issues there.

        Update: created a common images folder and then symlinked to it from each domain and worked like a champ. Thanks.

        —Brad
        "The important work of moving the world forward does not wait to be done by perfect men." George Eliot

      What still works is to have all domains using the same Perl and templates so, for example, instead of upgrading a Perl script in each of the domains, I only change it in one place.

      Think about using modules to control your script processing.

      use strict; use CGI; use CommonModule; use HTML::Template; my $q = CGI->new(); my $module = CommonModule->new( form_data => $q; ); my %templ_hash = $module->process_data(); my $template = HTML::Template->new(filename="$path/file.tmpl"); $template->param(%templ_hash); print $q->header(); print $template->output(); exit;

      This would be the basic form of your .cgi scripts in each domain which are unlikely to change. Now any edits you do in the module or template will be applied to each domain.

        I'd be curious to see what CommonModule looks like just so that I understand your example. Thanks.

        —Brad
        "The important work of moving the world forward does not wait to be done by perfect men." George Eliot

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://678591]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-24 05:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found