Help get this topic noticed by sharing it on Twitter Twitter, Facebook Facebook, or email.
Stephen Martin

playa and url segments

I'm looking at your example for siblings in the playa docs:

    {exp:playa:siblings entry_id="{segment_3}" parent_id="{segment_2}"}
  • {title}
  • {/exp:playa:siblings}


I'm wondering how you get the entry and parent id to show up in url segments. This seems to be what I want to do, but I can't figure out the segments as EE likes to have a template group/template path going on.
1 person has
this question
+1
Reply

  • Hi Stephen,

    EE isn’t very strict about what can go in the URL. You can get it to work with pretty much anything.

    What is the context that you’re trying to retrieve an entry’s siblings?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited

  • Stephen Martin
    I have a real estate site where there are neighborhoods and home plans in respective channels. Neighborhoods have multiple plans related via playa. When I'm on a plan page, I want to list all of the other plans available at that neighborhood as well--all the siblings of that plan under the parent neighborhood.

    I've been getting stuck on the url segments passing the correct template and losing the relationship between parent and child.

    What do you suggest?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited

  • Stephen Martin
    Okay, getting this to work. Damn you dynamic="no"! I'd rather use url_title than entry_id for the segments. What's a good workaround for this?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited

  • Which channel has the Playa field – Plans or Neighborhoods?

    It sounds like it's on Neighborhoods, so each neighborhood has multiple plans selected. If that's the case, then it's possible for a plan to belong to more than one neighborhood. So, when viewing a Plan, and you want to display other plans in the same neighborhood, how do you determine which neighborhood to get other plans from?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited

  • Stephen Martin
    Yes, neighborhoods has the playa field--which is actually in a matrix field.

    You're asking the question I'm trying to answer as well. I was first thinking of using the siblings tag and pass it the entry_id & parent_id as in your example. However, I'd rather use url_titles in the segments rather than ids. I worked a while on trying to convert url_titles to ids, but that didn't work within the playa tag.

    Now, I'm trying an embed, but I still have the url_titles vs entry_id problem. The url string looks like this: /template/neighborhood-name/plan-name. So, I need to convert the neighborhood-name segment to its entry_id, then pass it to the embed to pull all the plans which are it's children.

    In the neighborhoods channel I have a matrix field with the first column being a plan select menu (limited to 1 selection), column 2 is price and column 3 is availability.

    Anyway, that's my thinking. Found the url_titles to entry_id addon and am using that for the segment conversion. Still banging on it.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly indifferent, undecided, unconcerned happy, confident, thankful, excited