|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Nick W Smarty Rookie
Joined: 23 May 2003 Posts: 22
|
Posted: Fri May 23, 2003 10:21 am Post subject: Wrapper Class Dilema |
|
|
Hi everyone,
I'm in a bit of a fix, I've got calls to the
smarty class all over a large site and
now I wish desperately that I'd created a
wrapper class for it.
I need it so as I can export things like menus
to include files and automatically assign them
from the wrapper.
Is there any clever way to avoid having to
create the wrapper then go raound the whole
site finding all the smarty calls?
Many thanks, and btw, looks like a nice place
you have here
Nick |
|
Back to top |
|
sweatje Smarty Regular
Joined: 17 Apr 2003 Posts: 70 Location: Bettendorf, Iowa, USA
|
Posted: Fri May 23, 2003 11:11 am Post subject: |
|
|
This would be not so very clever, and probably prone to failure, try at your own risk, etc.
Rename the smarty class to Smarty_orig in your library source, then, in the same Smarty source file, add your extended class as
Code: | class Smarty extends Smarty_orig
{
...
} |
This should then be included and used by all your projects. Start working on your conversion to the right way of doing things without touching the source right away after that _________________ Jason
jsweat_php AT yahoo DOT com |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Fri May 23, 2003 2:54 pm Post subject: |
|
|
How are you calling Smarty? Statically or using something like one of:
$smarty->blah
$this->blah
??
Do have many different places in your code throught your site that use
$smarty = new Smarty;
or is only done in one place?
Or you can grep for new Smarty |
|
Back to top |
|
Nick W Smarty Rookie
Joined: 23 May 2003 Posts: 22
|
Posted: Sat May 24, 2003 9:03 am Post subject: |
|
|
Thanks guys,
I woke up this morning with the same idea as sweatje and will try it.
heh, boots!
Yes, it appears in many places, funcions and so forth for errors, sending 404's etc and sure, I can search and replace, I'd just rather not
Nick |
|
Back to top |
|
andre Smarty Pro
Joined: 23 Apr 2003 Posts: 164 Location: Karlsruhe, Germany
|
Posted: Mon May 26, 2003 9:11 am Post subject: |
|
|
Aehm... why don't you just use a search-and-replace over all files? |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|