• Resolved netschmiede24

    (@netschmiede24)


    Hi,

    I have a link in one pod template which recalls another pod view, filtered by ID, i.e.:
    https://www.domain.com/certainpage/?filter_podname=xxx => this works perfectly.

    Now I would love to display on this “certainpage” two fields from the pod that called this link (=the first and last name of this entry) So my question is: How do I get the ID from the URL, so I can create something like
    [pods name=”podname” field=”firstname” where=”id=$ID”]

    I need the $ID part to be the exact “xxx” from the URL where this is called.

    Just learning my way with pods… any help appreciated, thanks!

    Astrid

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @netschmiede24

    I think you mean the GET variables:
    https://docs.pods.io/displaying-pods/magic-tags/special-magic-tags/#Dynamic_Tags

    You could use {@get.filter_podname} to get the value of filter_podname (xxx)

    Cheers, Jory

    Thread Starter netschmiede24

    (@netschmiede24)

    how do I use the {@get.filter_podname} code in a WHERE clause? It doesn’t seem to work.

    Maybe I haven’t explained properly. So let me try to explain again:

    I have two pods: Pod 1 has profile details of people (name, company, address)
    Pod 2 has event details of events that the people of Pod 1 organize. The fields in pod 2 are event name, date, place, and a relationship field for pod 1 to determine who organizes this event.

    Now I do can easily display all events. And I can filter them by the organizer, so that I will only see the events of one organizer. But on this filtered page, I would love to have a header that reads something like “Here are all the events of XYZ”.

    So how do I get the XYZ in the header? I can have it displayed along with every event, but then it is repeated dozens of times on the site, if this organizer has a dozen events. On this particular filtered view, I want to read the name of the organizer once in the header. So I figured I must somehow retrieve the ID of XYZ in pod 1 from the filtered URL – and then use this ID as a where-clause to build a shortcode for the header. Is this possible or is there any other way to do this?

    Hope this explains …!

    Thanks,
    Astrid

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @netschmiede24

    Have you read the full document?
    https://docs.pods.io/displaying-pods/magic-tags/special-magic-tags/

    Important: In many cases, such as inside a shortcode, or in the Pods Blocks / Widgets settings, you must set the PODS_SHORTCODE_ALLOW_EVALUATE_TAGS constant for these tags to be used.

    In relation to your summary.
    Shouldn’t XYZ be the current post title? As you mention this view is placed on Pod 1 pages.
    If so, then it should be: Here are all the events of [pods field="firstname"]

    It could be that I still don’t fully get your configuration though.

    Cheers, Jory

    Thread Starter netschmiede24

    (@netschmiede24)

    XYZ is the filter-ID that can be found in the URL of a filtered pod view (https://domain.com/page-of-pod-2/?filter_pod1=XYZ). In other words, I am looking for a way to
    – not show the form filter on the website, but directly link from an item from pod 1 to pod 2, which is filtered by pod 1
    I am using this code in the pod template for pod1 to achieve this:
    <a href="../../page-of-pod-2/?filter_pod1={@ID}">All events of {@firstname} {@lastname}</a>
    – instead of showing the filter itself on the page of pod 2, I would rather show the info of this specific filtered object (post title, name, or whatever other fields) in the header = before the pod loop

    Is this clearer?
    Astrid

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @netschmiede24

    If you use ?filter_pod1={@ID} then the value of filter_pod1 would be the Pod 1 ID.
    You can use this to fetch this Pod using our shortcode.
    So you could do something like:

    [pods name="podname1" id="{@get.filter_podname}" field="firstname"]
    OR
    [pods name="podname1" id="{@get.filter_podname}"]{@firstname} {@lastname} etc.[/pods]

    Cheers, Jory

    Thread Starter netschmiede24

    (@netschmiede24)

    But this does not seem to work on the page for pod 2…. Nothing is displayed at all.

    Is there anything I must enable to make sure {@get.filter_podname} works?

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @netschmiede24

    Did you check this comment?
    https://www.ads-software.com/support/topic/get-the-id-from-a-certain-pod-via-the-url/#post-15913364

    The constant is a requirement.

    Cheers, Jory

    Thread Starter netschmiede24

    (@netschmiede24)

    Ah, yes… I missed something in that comment. Now it works beautifully – thanks a lot!

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @netschmiede24

    Perfect, thanks for letting me know!

    Cheers, Jory

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Get the ID from a certain pod via the URL’ is closed to new replies.