Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Wrapper Class Dilema

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
Nick W
Smarty Rookie


Joined: 23 May 2003
Posts: 22

PostPosted: Fri May 23, 2003 10:21 am    Post subject: Wrapper Class Dilema Reply with quote

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 Wink

Nick
Back to top
View user's profile Send private message
sweatje
Smarty Regular


Joined: 17 Apr 2003
Posts: 70
Location: Bettendorf, Iowa, USA

PostPosted: Fri May 23, 2003 11:11 am    Post subject: Reply with quote

This would be not so very clever, and probably prone to failure, try at your own risk, etc. Shocked

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 Laughing
_________________
Jason
jsweat_php AT yahoo DOT com
Back to top
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri May 23, 2003 2:54 pm    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
Nick W
Smarty Rookie


Joined: 23 May 2003
Posts: 22

PostPosted: Sat May 24, 2003 9:03 am    Post subject: Reply with quote

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 Wink

Nick
Back to top
View user's profile Send private message
andre
Smarty Pro


Joined: 23 Apr 2003
Posts: 164
Location: Karlsruhe, Germany

PostPosted: Mon May 26, 2003 9:11 am    Post subject: Reply with quote

Aehm... why don't you just use a search-and-replace over all files?
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP