We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

Avatar
Join the discussion…


  • in this conversation
    Log in with
    or sign up with Disqus or pick a name

    Disqus is a discussion network

    • Disqus never moderates or censors. The rules on this community are its own.
    • Don't be a jerk or do anything illegal. Everything is easier that way.

    Read full terms and conditions

    By signing up, you agree to the Disqus Basic Rules, Terms of Service, and Privacy Policy.
    By posting, you agree to the Disqus Basic Rules, Terms of Service, and Privacy Policy.
    • Avatar

      I'm looking to basically do the opposite. I have a main page, so how can I access properties of a page located under a separate module of that main page? Something like: Context:CurrentIndex.Page.Module("con_Module").Elements.GetElement(stf_ModuleHeading").GetHtml().ToString()

        • Avatar

          Hi there! Sorry to get back to you so late but here is a rough code snippet of how you would do this.

          Context:CurrentIndex.Page.Elements.GetElement("con_Module").Value[Int:0].GetElement("stf_ModuleHeading").GetHtml().ToString()

          This would grab the first module connected in that container and pull out the stf_moduleheading. (this is in Version 10)

            • Avatar

              Hey Jon,

              Thanks for the help on the earlier question. I have another.

              I'm trying to use a Context object in a reddot:cms query. When I use <%!! Context:CurrentIndex.GetRootIndex().Page.GetElementByName(opt_myoption).GetHtml() !!%> in my template code and the Root page DOES NOT have that opt_myoption element, it works ok because the value just comes out as blank (""). But when I try to use that piece in a reddot:cms query, ex:

              <reddot:cms><if><query valuea="Context:CurrentIndex.GetRootIndex().Page.GetElementByName(opt_favicon_package).GetHtml()" operator="!=" valueb=""><htmltext>DO THINGS</htmltext></query></if></reddot:cms>

              I'm getting the error:
              RequestPageFromPageBuilder: Page with id 22695: BuildNavigationErr: ERROR#5, Value does not fall within the expected range.

              I know that this is because the element doesn't exist, but how the heck can I perform the query and check if the element DOES EXIST first? I can't nest queries, I've already tried that. Any insight?

                • Avatar

                  Hi again!

                  There are a few options after talking with my colleagues:

                  1) Put a standard field on all content classes with a default value, but the root page would be blank, so you can check to see if that placeholder is blank, then you are on the root page and ignore the second query.
                  2) Check directly against the name of the Template.Name in your context tag to see if its the root page and ignore the second part.

                  Lastly I just wanted to mention that you can indeed next queries using the <reddot:cms> style tags, which you would need to do in order to accomplish the above ^

                    • Avatar

                      Thanks Jon, appreciate the details. How would I nest, would you give an example? Trying to nest like <reddot:cms><if><query><if><query></query></if></query></if></reddot:cms> wasn't working. What was I doing wrong?

                        • Avatar

                          Here is an example of a working nested query. Check to see if the option is "yes" for showing image. Then inside that check to ensure that the image is there, then output the <img> tag.

                          <reddot:cms>
                          <if>
                          <query valuea="Context:CurrentPage.Elements.GetElement(opt_showImage).GetHtml().ToString().ToLower()" operator="==" valueb="String:yes">
                          <if>
                          <query valuea="Context:CurrentPage.Elements.GetElement(img_image).GetHtml()" operator="!=" valueb="">
                          <htmltext>
                          <img src="&lt;%img_image%&gt;" alt="&lt;%att_altText%&gt;" title="&lt;%att_altText%&gt;"/>


                          </htmltext>
                          </query>
                          </if>
                          </query>
                          </if>
                          </reddot:cms>