Config directives in Smarty.class.php

From: Date: Thu, 21 Jun 2001 09:30:52 +0000
Subject: Config directives in Smarty.class.php
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-924@lists.php.net to get a copy of this message
Hi, As a maintainer of several different web applications I put a few generally used class files in a common include directory. These include for example the database abstraction and session classes from PHPLIB. PHPLIB lets me adjust the application specific config variables by subclassing the 'real' class in a local.inc (which is in a include dir for only that application) and using the subclassed version in my application. This works nicely and even allows me to override some of the behaviour by redefining methods in the class. With smarty however I have to adjust the Smarty.class.php file because although it allows me to subclass it, the Compiler class is also a subclass of the Smarty class and this causes a problem. The code that actually instantiates the Compiler class (in Smarty.class.php) tries it's best to set every variable to the same value as the calling Smarty instantiation. The problem is that the constructor of Smarty gets called before the variables can be set and, if you alter the path to your configs dir, the correct config dir is not found (it searches for the default './configs'). I have been pondering how to solve the problem of not wanting to alter the Smarty code but still using a different configuration. With no luck so far. Maybe you can help? By the way, subclassing would be a great for adding functions and modifiers. Greetings, Ralph Meijer.

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