--- Trond Michelsen <[EMAIL PROTECTED]> wrote:
> Completely guessing here - but are you by any chance
> mapping all
> requests to /client/ and beyond to your handler, and
> then using this
> handler to find the templates from
> /home/client/templates/ ?
Yes. I'm using the uri to identify which template to
use(this is slightly different from the code in my
first post, but this is the actual code I'm using
now).
### Get feature/client codes from URL ###
my $uri = $r->uri;
$uri =~ s!^/!!;
my($script, $client_param, $feature_param, $page) =
split(/\//,$uri);
I should always have $script ('client') and
$client_param ('zzx')...but $feature_param and $page
are optional (for example, if $feature_param =~
/.html/, then I know a url like
www.domain.com/client/zzx/index.html was called and
for another example, if $page is not defined, then I
had a url like www.domain.com/client/zzx/ga/ - this is
messy...see my note at the end of this post).
I use the following param when calling Template->new:
INCLUDE_PATH => "$websrc:$websrc/lib",
where $websrc = '/home/client'
So later when I use
$template->process($file, $params)
then when
$file = 'zzx/ga/index.html'
the following template will be used
/home/client/templates/zzx/ga/index.html
NOTE: In a nutshell, here's what I need to do:
www.domain.com/client/zzx/ga/index.html
www.domain.com/client/zzx/ga/
www.domain.com/client/zzx/ga
should all correspond to the template
/home/client/templates/zzx/ga/index.html
and I also need to match templates up a directory
www.domain.com/client/zzx/index.html
www.domain.com/client/zzx/
www.domain.com/client/zzx
should all correspond to the template
/home/client/templates/zzx/index.html
I'm using the <Location> directive to map /client to
Client.pm. Truthfully, I'm thinking about using
<FilesMatch> to match urls with .phtml extensions to
my handler. I only need to pull the 'zzx' (client)and
'ga' (feature) from the url to determine which
template to use (I'll always have a client, but not
always a feature). Using FilesMatch should allow me to
get rid of the 'client' in my url, or at least allow
me to change the url to something like
www.domain.com/zzx/client/ga/index.phtml, which is
what the designers want.
This is my first project with TT and I'm learning as I
go, so perhaps my approach could be better. And not
only do I get to learn/use/advocate TT, I also get to
kill ColdFusion in the process :)
Thanks again for all the help...
__________________________________________________
Terrorist Attacks on U.S. - How can you help?
Donate cash, emergency relief information
http://dailynews.yahoo.com/fc/US/Emergency_Information/