0

EE 2.6.1

I have a page with a standard channel entries tag as follows:

{exp:channel:entries limit="1" channel="{embed:category}"}

{/exp:channel:entries}

followed by another channel entries tag, which is included as an embedded file:

{exp:channel:entries limit="6" channel="{segment_1}" url_title="not {segment_2}" orderby="random" dynamic="no"}

What I'm trying to do is show further entries from the same channel, but not the entry in the second segment, which is already being shown on the page. So, if I was displaying an entry from the Cakes channel, the 2nd channel entries tag would show a list more more cakes, but not the one being displayed on the main section of the page. The url_titl="not {segment_2}" does not seem to be working.

Any help much appreciated.

Kind regards,

Matt

3 Answers 3

1

Matt, id use a plugin called stash. Take some time to read the docs and do little tests to see how it works. Most people who start using it misunderstand parse order. Using stash set_list wrapping a single channel:entries tag you can create a list of all seven entries, then later in the same template use get_list to display in your markup. This approach will save using a second CI tag and an embed, which means less queries and overhead.

1
  • I'd agree with dadonbike on using Stash. Think about it like using one channel:entries tag, storing all this data in an array and then calling on that array to display a single entry, and then calling again on that array to display the set of 6 entries. Here are some Stash based links you might find helpful: Stash (github.com/croxton/Stash), EE Insider Article: (eeinsider.com/articles/template-partials-using-stash) Aug 18, 2013 at 11:46
0

I couldn't understand why parameter url_title="not {segment_2}" isn't working while segment variables are parsed so early. Also, you are using channel="{segment_1}" which seems working for you.

As you mentioned that you are putting that channel entry tag within embedded template so try by having url_title as embed variable like:

{exp:channel:entries limit="6" channel="{segment_1}" url_title="not {embed:url_title}" orderby="random" dynamic="no"}

You can try it and share if it worked.

0
0

I know this is a slightly old post but for benefit of others doing this kind of thing, I've just used url_title="not {segment_3}" to do exactly this - exclude the currently viewed entry from a list of other randomly displayed recent entries in a list. It seems to work fine. My code is:

{exp:channel:entries channel="my-channel" limit="3" orderby="random" dynamic="no" disable="member_data|trackbacks|pagination" status="open" url_title="not {segment_3}"}
*preview list of 3 recent entries displayed, excluding the one being currently viewed*
{/exp:channel:entries}

Having said all that, I know I should learn how to use Stash. Everyone raves about it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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