RE: [SMARTY] Configuring apache to fallback to a default template handler

From: Date: Mon, 05 Apr 2004 15:36:21 +0000
Subject: RE: [SMARTY] Configuring apache to fallback to a default template handler
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-11231@lists.php.net to get a copy of this message
> 2, templates/*.html - if this exists then passthru to > htdocs/default.php > (eg. templates/about/company.html) > > 3, otherwise, perform a normal 404 error via Apache. > > I want default.php to act purely as a handler, it receives the > request with the original URL including fragment and query string > intact. It will determine which template to fetch from > $_SERVER["REQUEST_URI"], and all $_REQUEST/$_GET/$_POST > vars are assigned as usual. > It sets up Smarty and displays the template (wrapped in the usual > gubbins, ie side bars, navigation, header, footer etc.) If I get the right idea about what you're trying to do, one way is to create a custom handler, either in your httpd.conf file or in templates/.htaccess. You may find it easier not to use a .html extension, but pick something else -- maybe .smarty or .page -- anything which is going to be unamibguous (I can't see much reason why .html wouldn't work, but using a different extension will make your debugging life that little bit easier): AddHandler smarty-template .smarty Action smarty-template /path/to/parser.php Your parsing PHP file can then instantiate the smarty object, and perform any other basic operations. The full path to the .smarty file will be available as $_SERVER['PATH_TRANSLATED']. A slightly more expanded version of this explanation is in the Smarty Wiki at http://smarty.incutio.com/?page=SmartyFrequentlyAskedQuestions#install-4 Scott -- Scott Matthewman

« previous php.smarty.general (#11231) next »