0

I've created two separate Structure entries, both using the Page template below with Relationship entries. It works fine if I only want one page, but I've made a second page to pull different Relationship entries for each page, but now it's just pulling the same relationship entries for both pages. I tried using entry_id="{entry_id} in the {exp:channel:entries} on the recipe_ajax/index template and that didn't work...only works when I explicitly write the id.

Is there another way to parse the ajax template so that I can use the dynamic entry_id="{entry_id} to pull correct entries? Or am I missing something completely obvious?

Here's my Page template:

{embed="layouts/index"}

{!-- PAGE CONTENT --}
{exp:stash:set parse_tags="yes"}

    {exp:channel:entries cache="no" refresh="60" disable="category_fields|member_data|pagination"}

        {stash:content}

            <div class="recipes-section add">
                <div class="container">
                    <div class="row">
                        <div class="col-xs-12">
                            <div class="article-holder row" id="container">
                                {recipes_landing_recipes limit="15"}
                                    <div class="grid-item article col-xs-12 col-sm-4 col-md-3 all {recipes_landing_recipes:categories}{exp:streeng slug='yes'}{category_name} {/exp:streeng} {/recipes_landing_recipes:categories}">
                                        <a href="{route='recipes/recipe_detail' title='{recipes_landing_recipes:url_title}'}">
                                            <div class="img-holder">
                                                <img src="{if recipes_landing_recipes:recipe_featured_image}{recipes_landing_recipes:recipe_featured_image}{if:else}/assets/images/bsl-placeholder.jpg{/if}
                                                " height="366" width="342" alt="{recipes_landing_recipes:title}">
                                            </div>
                                            <strong class="title">{recipes_landing_recipes:title}</strong>
                                        </a>
                                    </div>
                                {/recipes_landing_recipes}
                            </div>
                            <a class="btn btn-danger btn-load" href="{path='recipe_ajax/index'}" style="display: none;">view more</a>
                        </div>
                    </div>
                </div>
            </div>

        {/stash:content}

    {/exp:channel:entries}

{/exp:stash:set}

And here's the recipe_ajax/index template:

{exp:channel:entries channel="recipes_landing" cache="no" refresh="60" disable="categories|category_fields|member_data|pagination}
    <div class="post-section">
        {recipes_landing_recipes offset="15"}
            <div class="grid-item article col-xs-12 col-sm-4 col-md-3 all {recipes_landing_recipes:categories}{exp:streeng slug='yes'}{category_name} {/exp:streeng} {/recipes_landing_recipes:categories}">
                <a href="{route='recipes/recipe_detail' title='{recipes_landing_recipes:url_title}'}">
                    <div class="img-holder">
                        <img src="{if recipes_landing_recipes:recipe_featured_image}{recipes_landing_recipes:recipe_featured_image}{if:else}/assets/images/bsl-placeholder.jpg{/if}" height="366" width="342" alt="{recipes_landing_recipes:title}">
                    </div>
                    <strong class="title">{recipes_landing_recipes:title} {recipes_landing_recipes:entry_id}</strong>
                </a>
            </div>
        {/recipes_landing_recipes}
    </div>
{/exp:channel:entries}

UPDATED ANSWER:

I was able to resolve by calling the entry_id_path in the Page template {entry_id_path='recipe_ajax/index'} and referencing this path in the ajax file like so entry_id_path="{entry_id_path}

  • Are you trying to load more related entries from the parent entry or something else? – stuartmcd69 Apr 28 '17 at 10:19
  • Since I was using the same page template without referencing the entry_id in the ajax file, it was just pulling all the entries no matter what relationship entries were selected. I resolved issue and included my answer above. – frshjb373 Apr 28 '17 at 15:46
0

Not sure what you are actually trying to do.

If I understand it all, it seems your link is emulating a pagination link - so the link will open a view of the next block of results from {recipes_landing_recipes} results. If so, perhaps you could just make use of EE's pagination features to do this. Would be less complicated I think.

I think you are complicating this by using {stash} but since you are, you could perhaps just dump out all the recipes into stash once and then pull them from there when you need them.

HTH

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.