We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Module scope/multiple objects

Development and Programming

Leisuretronics's avatar
Leisuretronics
2 posts
14 years ago
Leisuretronics's avatar Leisuretronics

Hi there,

I have created a custom module that, among other things, has a translate method. So in my templates, I call it using:

{exp:module:translate}String to translate{/exp:module:translate}

Trouble is that with every instance of this tag, there is a new object being initialized. Is there a setting to keep the object alive and reuse it?

Is EE creating the object, running the method, then destroying the object?

I had a look through the forums but I couldnt find anything similar.

Thanks.

Moved to Development and Programming by Moderator

       
Sue Crocker's avatar
Sue Crocker
26,054 posts
14 years ago
Sue Crocker's avatar Sue Crocker

Hi, Holt.

Unfortunately we don’t provide direct support for troubleshooting modules, but I can move this to the Development and Programming forum where other community members can assist.

       
Leisuretronics's avatar
Leisuretronics
2 posts
14 years ago
Leisuretronics's avatar Leisuretronics

Thanks Sue,

I was trying to get a bead on how objects are handled with EE, regarding creation and usage. From the looks of it, for every call to that tag, a new object is being created?

I was just wondering if there was a way to stipulate the module as a singleton, so that every call within the template uses the same instance?

       
the3mus1can's avatar
the3mus1can
426 posts
14 years ago
the3mus1can's avatar the3mus1can

Each tag will be its own instance but you can use static variables to pass data between the instances.

Check out

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.