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

Nested Module Tags

Development and Programming

Darron's avatar
Darron
7 posts
17 years ago
Darron's avatar Darron

Hello,

I have hacked the mod.weblog.php module to add a method that returns the SQL used to generate weblog entries.

I want to be able to retrieve this SQL and feed it into another module that needs to use the exact same SQL that was used to generate the weblog entries.

I created the method o5_get_sql within mod.weblog.php and it’s working, but I cannot successfully nest the tags in the following manner:

{exp:o5_gmap sql='{exp:weblog:o5_get_sql weblog="{my_weblog}” orderby=”date” sort=”desc” limit=”15”}’}

Dissected: {exp:weblog:o5_get_sql weblog="{my_weblog}” orderby=”date” sort=”desc” limit=”15”} on it’s own will produce the SQL text that I need, but when embedded as the sql parameter in the {exp:o5_gmap …} module tag, it doesn’t parse the embedded {exp:weblog:o5_get_sql …} tag. It just sends the exact text of the tag in as the SQL.

If this is not allowed, please suggest an alternative approach. I’ve tried to create a separate template to contain the {exp:weblog:o5_get_sql …} tag and use the “embed” keyword but it believe that it parses all of the tags in my original template before the embedded template. I need the embedded template to be parsed first.

Thanks in advance! Darron.

       
Derek Jones's avatar
Derek Jones
7,561 posts
17 years ago
Derek Jones's avatar Derek Jones

Hey Darron, instead of looking for a way to allow the syntax you are attempting, can you step back and explain what this other module’s purpose is? I think you may be trying to climb a building but missing the front door and elevator that will take straight to the top. I’ll be able to give you sound advice in any case if I understand what it is you are wanting to accomplish.

       
Darron's avatar
Darron
7 posts
17 years ago
Darron's avatar Darron

Ok. It’s quite possible that I’m backing myself into a corner after failed attempts at accomplishing what I want to accomplish taking the “direct route” using EE tag and Javascript.

I want to embed a single google map that takes data from multiple instances of the {exp:weblog:entries … } tag with varying parameters supplied in each to retrieve different sets of data.

Problem #1: Javascript, the scope of the variable that references the instantiated Google map. I attempted to embed several instances of {exp:weblog:entries … } … do map stuff based on weblog entry data … {/exp:weblog:entries} with moderate success. I could get one instance of this tag/javascript set to work, but could not get others because the scope of the variable that references the map is inaccessible from instance to instance. If there was a way to reference this variable or retrieve the reference and reassign to a variable that would be in scope, then problem solved.

Problem #2: After unsuccessful attempts at solving Problem #1, I attempted to embed the entire body of the template in a javascript to create a situation where all instances of {exp:weblog:entries … } … do map stuff based on weblog entry data … {/exp:weblog:entries} had the variable referencing the map in scope. However, I ran into problems with Javascript parsing of data coming back from {exp:weblog:entries … } {Summary} {/exp:weblog:entries} (for example). The Javascript parser was choking on the text coming back from embedded tags even though I was placing them in quotes to make it literal. Inline expansion of the tags resulted in Javascript choking on the result.

Problem #3: Where I am now is to find a way to just get the SQL that is generated by {exp:weblog:entries … } and process that myself.

I hope that sheds some light on my frustrating journey.

Darron.

       
Derek Jones's avatar
Derek Jones
7,561 posts
17 years ago
Derek Jones's avatar Derek Jones

To be sure I understand what you are needing, let me rephrase, and you tell me if I’ve got it. You have multiple weblog entries tags on a page load. They output variables that you wish to use on a single Google map. Is that correct?

       
Darron's avatar
Darron
7 posts
17 years ago
Darron's avatar Darron

That is correct.

       
Derek Jones's avatar
Derek Jones
7,561 posts
17 years ago
Derek Jones's avatar Derek Jones

If the entries tags are all on the same template, then a very easy to implement solution for you would be Mr. Wilson’s Reeposition plugin, which essentially will take the output of any tag and allow you to reposition it to another position in the markup, even above where the tag is called.

       
Darron's avatar
Darron
7 posts
17 years ago
Darron's avatar Darron

Ok. Let me read a little about this and get back to you. Stand by! 😊

       
Darron's avatar
Darron
7 posts
17 years ago
Darron's avatar Darron

Hmmm very cool plug-in. Turns out my looking into this freed my thinking and the obvious solution jumped out at me. I didn’t need the plug-in after all, but will install it and keep it in the tool chest as I am sure I will use it in the future.

Thanks for your quick response and expert help!

Darron.

       
Derek Jones's avatar
Derek Jones
7,561 posts
17 years ago
Derek Jones's avatar Derek Jones

No problem, Darron, I’m happy to have helped.

       

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.