We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3349
    • 126 Posts
    Im trying to get the resource id of the current page but within a getResources call (which calls data from a separate directory)... the reason being im taking the user out of one directory and into another to show shared content and I need the resource id stored so I know where they came from...

    So my tree setup is basically this

    Event
    ----Event 1 (id=5)
    -------Speaker Listing (using getResoucres call)
    ----Event 2
    -------Speaker Listing (using getResoucres call)
    .
    .
    .
    Speakers (id=10)
    ----Speaker 1
    ----Speaker 2
    ----Speaker 3

    My getResoucres call....

    [[!getResources? &resources=`10` &depth=`0` &includeContent=`1` &showHidden=`1` &tpl=`SpeakerListTpl` &sortby=`menuindex` &sortdir=`asc` &includeTVs=`1` &processTVs=`1` &limit=`0`]]


    This is my link out in my SpeakerListTpl

    <a href="[[~[[+id]]?&eventid=[[+parent]]]]">


    Using the obvious [[+parent]] only gives me the id of the resource where the getresources call is referencing in this case id=10

    But im looking for id=5 (i.e the event id)

    Any clever way to do this?

    Many thanks
      • 40706
      • 128 Posts
      Then use [[*parent]]

      [[* ]] vars use those from the active Page, instead of those snippets loop through
        • 3349
        • 126 Posts
        Thats awesome! I never knew that.... and i thought [[* ]] never worked within snippets!

        Now i'm passing the correct id in the url but im having difficulty at the other end

        Im using:

        [[!getUrlParam?&name=`eventid`&int=`1`]]


        This returns the correct value HOWEVER, when I use this call within a link tag i.e:

        <a href="[[~[[!getUrlParam?&name=`eventid`&int=`1`]]]]">Back to Event</a>


        No value is output?

        Any ideas?

          • 3349
          • 126 Posts
          I should have mentioned what does get output from the link tag is

          <a href>Back to Event</a>


          so it strips out the
          ="*eventid*"
            • 40706
            • 128 Posts
            Maybe it`s an caching issue, then you should call the Url generation also uncached.

            <a href="[[!~[[!getUrlParam?&name=`eventid`&int=`1`]]]]">Back to Event</a>
              • 3349
              • 126 Posts
              That did the trick. Many thanks, at one point I was staring into the abyss!