Re: [SMARTY] default templates?

"Jeroen de Jong" <[email protected]>
Newsgroups gmane.comp.php.smarty.general
Message-ID <038801c5d41e$e6748330$6d02a8c0@jupiter>
In your Apache config or .htaccess file you could do something like:

RewriteEngine On
RewriteRule ^/static([a-z]+)\.php$ /staticpage.php?template=$1 [L]


see: http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html

Jeroen


----- Original Message ----- 
From: "Josh Santangelo" <[email protected]>
To: <[email protected]>
Sent: Tuesday, October 18, 2005 9:31 PM
Subject: [SMARTY] default templates?


I'm working on a site that has a lot of dynamic content for which there 
are PHP scripts and Smarty templates for each. Additionally, there is 
lots of static content that does not need a separate PHP script for each.

Explaining the layout might help understand the problem:

/private/
/private/templates/
/private/templates/dynamicpage.tpl
/private/templates/staticpage.tpl
/public/ (the public web root)
/public/dynamicpage.php

So when a browser goes to http://host/dynamicpage.php, that script runs 
and pulls in dynamicpage.tpl. What I'd like to do is be able to go to 
http://host/staticpage.php and pull up staticpage.tpl without 
staticpage.php actually existing.

This is because I don't want to create a ton of staticpage.php files for 
each page of static content -- there would be hundreds of them in this 
case, and would make for a maintenance nightmare.

I don't want to do something like 
/staticpage.php?template=staticpage.tpl, because that's ugly and not 
search-friendly.

I can't do /staticpage.php/staticpage.tpl, because PHP is running as CGI 
and not as a module, and apparently that doesn't work.

I don't want to do some kind of trick with a custom 404 page, because 
then the log will fill up with 404 errors.

I figure the answer must be some sort of mod_rewrite trick, which I 
could sit around and figure out, or I could ask here because I'm sure 
it's been done already. :)

-josh

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.