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.

EE2: Displaying older entries with stop_before parameter?

September 06, 2010 6:19am

Subscribe [2]
  • #1 / Sep 06, 2010 6:19am

    jknuutila

    27 posts

    I’d like to display 5 posts that are written prior to the blog post that is currently being viewed. Can I use stop_before to achieve this? I tried to following code, but it didn’t work:

    {exp:channel:entries channel="blog" dynamic="off" stop_before="{entry_date format="%Y-%m-%d %H:%i"}" orderby="date" sort="desc" limit="5"}
    {title}
    {/exp:channel:entries}
  • #2 / Sep 06, 2010 1:43pm

    jknuutila

    27 posts

    This might have something to do with the parsing order of EE code? Hard coding the entry_date seems to work, but it really defeats the purpose in this case.

  • #3 / Sep 07, 2010 1:41am

    Loye Pack

    15 posts

    Could you limit=“6” then check {if count == 1} do nothing, otherwise, build the entry?

  • #4 / Sep 07, 2010 5:23am

    Andy Harris

    958 posts

    According to le docs, you need to enable PHP to do this dynamically:

    http://ellislab.com/expressionengine/user-guide/modules/channel/parameters.html#par_stop_before

  • #5 / Sep 07, 2010 6:03am

    jknuutila

    27 posts

    So I need PHP to get the entry date of the entry that is being viewed at the moment, with EE it’d be really easy just to use:

    {exp:channel:entries channel="blog" url_title="entry-currently-being-viewed" limit="1"}{entry_date format="%Y-%m-%d %H:%i"}{/exp:channel:entries}

    Any help?

  • #6 / Sep 07, 2010 6:07am

    Andy Harris

    958 posts

    What I’d do is to create an embed with the 5 posts you need, and pass entry_date from the viewed entry into the embed. Then if you need turn PHP on in the embed and convert the date, so be it - it’d work.

    {exp:channel:entries channel="blog" url_title="entry-currently-being-viewed" limit="1"}
    {embed="template/posts" date="{entry_date format="%Y-%m-%d %H:%i"}"}
    {/exp:channel:entries}
  • #7 / Sep 07, 2010 8:44am

    jknuutila

    27 posts

    Thanks Andy, that worked fine!

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

ExpressionEngine News!

#eecms, #events, #releases