getStatic
| From: | Craige Leeder | Date: | Tue, 25 Nov 2008 04:02:39 +0000 |
| Subject: | getStatic | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-283796@lists.php.net to get a copy of this message | ||
Hey guys,
So, I was working on my framework today, and noticed unfortunately that PHP does not allow using the magic method __get for static variables. There is a patch available, but I'm not sure how long it will be before it makes it into the stable PHP release.
Anyway, my question is about what route I should take now.
The reason I was looking for this was for the built in template engine. I expected to be able to put in a page
{HTML::$variable1}
or
{self::$variable1}
and have it evaluate using native PHP variables, instead of doing a large number of PHP str_replace for text based variables, a process which is surely slower.
As I see it, my options are:
Create
public static function get($fpName)
And have my templates littered with the extra
{HTML::get(variable1)}
OR
use PHP str_replace based variable parsing creating what I imagine would be a significantly higher overhead.
What would you do?
- Craige