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.

limit parameter incrementation?

January 26, 2009 3:43pm

Subscribe [2]
  • #1 / Jan 26, 2009 3:43pm

    soxhead

    69 posts

    Ok, so here’s some pseudo-code for what I’m doing right now:

    {exp:weblog:entries limit="10"}
    {if condition1 is met}
    Display nothing
    {elseif}
    Show the contents of entry
    {/if}
    {/exp:weblog:entries}

    Here’s the sticking point:

    If only 5 of the 10 entries meet the conditional criteria, only 5 posts will display on the page. Is there a way that I can modify the code so that 10 entries will ALWAYS be displayed, regardless of how many are skipped? Ie: some means of manual incrementation to the limit parameter?

  • #2 / Jan 26, 2009 6:10pm

    liquilife

    147 posts

    Have you looked into using the search:body parameter for the weblog tag?

    {exp:weblog:entries limit="10" search:body="not something|stuff"}
    Show the contents of entry
    {/exp:weblog:entries}

    The search:body parameter searches through all the data in your entries, even standard custom fields, and gives you 10 entries based on your sort/filter. In my example, it would exclude entries containing the specific words ‘something’ and ‘stuff’.

    Anyways, take a look at the full documentation here on this variable. There is a lot you can do with it and will probably fit your needs. Hopefully anyways.

  • #3 / Jan 26, 2009 8:59pm

    soxhead

    69 posts

    Awesome, that’s perfect, liquilife. I had never heard of this parameter before, but I have a feeling it will quickly become a favorite.

    Thanks a lot!

  • #4 / Jan 26, 2009 9:08pm

    liquilife

    147 posts

    You are welcome. It’s come in handy for me as well. Just remember to replace ‘body’ with the short name of the field you want to filter by.

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

ExpressionEngine News!

#eecms, #events, #releases