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

Knowing how many times a module has been used in a template...

Development and Programming

Daniel H.'s avatar
Daniel H.
22 posts
16 years ago
Daniel H.'s avatar Daniel H.

Howdy,

I’m working on developing a Google Maps plug-in, which is working quite well. What I currently need, though, is some way to know how many times my module has been called on the same page. I’ve searched this site all through, and haven’t found a thing.

The general gist is this:

{exp:mapper id="testMap1"}

{exp:mapper id="testMap1"}

{exp:mapper id="testMap2"}

I want to know, when the mapper module is called, how many times it’s been previously run.

Perhaps a global of some kind? I tried declaring one, but it didn’t seem to persist.

Thanks for the input!

-Daniel

       
Daniel H.'s avatar
Daniel H.
22 posts
16 years ago
Daniel H.'s avatar Daniel H.

No ideas?

-Daniel

       
Daniel H.'s avatar
Daniel H.
22 posts
16 years ago
Daniel H.'s avatar Daniel H.

Ok, now I just feel dumb. That makes perfect sense!

Thanks, Victor!

-Daniel

       
Daniel H.'s avatar
Daniel H.
22 posts
16 years ago
Daniel H.'s avatar Daniel H.

New question.

So I’m trying to write out JavaScript code, but on every additional call of the module, I need to modify some early written/rendered output. Any thoughts on how to do this? I’m searching through the documentation looking for a way to access previous output, but no luck yet.

If I knew when the last time my module would be called is, I could just create my final Javascript code version during that time.

The code looks something like:

<script type="text/javascript">
function init()
{
Drawbox("div1");
Drawbox("div2");
Drawbox("div3");
}
</script>

When my first call comes along, it would output this:

<script type="text/javascript">
function init()
{
Drawbox("div1");
}
</script>

Second time:

<script type="text/javascript">
function init()
{
Drawbox("div1");
Drawbox("div2");
}
</script>

And the third time would be like I first showed the example.

I’m not sure I can do that. 😕

I’m going to look into some JavaScript get workarounds for now. 😊

Thanks!

-Daniel

       
Daniel H.'s avatar
Daniel H.
22 posts
16 years ago
Daniel H.'s avatar Daniel H.

Awesome, Victor! Thanks!

Now I’m curious where in the documentation those functions were mentioned… I’ve been all through the template parser class documentation… I didn’t see those there. 😕

Thanks again.

-Daniel

       

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.