ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

I need custom variables, or access to the parent loop?? (bad title, sorry, it's explained inside)

August 16, 2012 4:13pm

Subscribe [3]
  • #1 / Aug 16, 2012 4:13pm

    Travis Kohn

    18 posts

    Hi all, I’m new to EE and I’m having some troubles with something that I could quite easily solve in PHP (or any language really), but I’d love to do this the EE way and really get my head around the template system.


    What I’m trying to do:

    I have a Product Review, that review is related to a Product, and my page is comprised of both entries, like this:

    {exp:channel:entries channel="products"}
        {reverse_related_entries channel="reviews"}
            THIS IS WHERE I WANT ACCESS TO A FEW *PRODUCT* VARIABLES, NOT JUST REVIEW VARIABLES
        {/reverse_related_entries}
    {/exp:channel:entries}

    I’d love to be able to store the *few* items from the enclosing loop so I can use them later in the related_entries loop.

    I ran across a module called “stash” that I haven’t tried yet because I’m still searching for the native EE solution (if it exists).

    Thanks everyone!
    Pete.

  • #2 / Aug 16, 2012 7:06pm

    tidy

    196 posts

    Hi Petar,
    I don’t *think* there is a native EE way for this.
    A couple of options would be:
    1) enable PHP on output in your template and then use PHP to store the product info as variables and output them within the reviews
    2) use an add-on like Stash or MX Jumper etc - Stash is tremendous, but I sometimes end up in knots with it and find MX Jumper easier in certain cases

  • #3 / Aug 17, 2012 7:22am

    Travis Kohn

    18 posts

    Thank you for the advice, it is appreciated.

    Anyone else know if this is the only way to solve this problem?

  • #4 / Aug 17, 2012 11:10am

    e-man

    1816 posts

    Looks like you may have to use an embed and pass the variables you need on to that.
    See http://ellislab.com/expressionengine/user-guide/templates/embedding.html

    Stash could be useful too.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases