default templates?
| From: | Josh Santangelo | Date: | Tue, 18 Oct 2005 19:31:01 +0000 |
| Subject: | default templates? | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-13090@lists.php.net to get a copy of this message | ||
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