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.

Variable based on displayed entries

October 13, 2010 3:04am

Subscribe [2]
  • #1 / Oct 13, 2010 3:04am

    TJ Draper

    222 posts

    Is there a way to only render certain code if more than one entry is displayed?

    For instance, the particular template I’m working with is set to a limit of 6 entires:

    {exp:channel:entries channel="blog" orderby="date" sort="desc" limit="6"}

    What I’m trying to do is render a divider between entries when there’s more than one, but when linking directly to an entry through that template, not display the divider. Does that make sense?

    I’ve been pouring over the if statements and variables and I just can’t quite come up with it.

    What I initially tried was:

    {if segment_2=="" OR segment_2=="category"}divider code here{/if}

    My thinking was if segment two wasn’t blank, and it wasn’t a category, then it was a link to a single entry.

    But then I realized that this wouldn’t work with pagination because segment_2 was suddenly no longer empty when you went beyond the first page, meaning the divider code wouldn’t display.

    Any thoughts? Anything I’m missing?

  • #2 / Oct 13, 2010 7:36am

    e-man

    1816 posts

    What I’m trying to do is render a divider between entries when there’s more than one, but when linking directly to an entry through that template, not display the divider.

    Something like this should do it, this will also keep from adding a divider after your last article.

    {exp:channel:entries channel="your channel here"  limit="6"}
    {your content here}
    {if count != total_results}<div>divider</div>{/if}  
    {/exp:channel:entries}
  • #3 / Oct 23, 2010 3:38pm

    TJ Draper

    222 posts

    I’m just now getting back to this, I’ve been swamped. But this is awesome, thanks!

    That, in addition to this: http://expressionengine.com/wiki/Hiding_Pagination/ is exactly what I needed.

    Thanks again!

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

ExpressionEngine News!

#eecms, #events, #releases