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.

Category limit parameter is not working

May 05, 2008 5:16pm

Subscribe [1]
  • #1 / May 05, 2008 5:16pm

    atealtha

    21 posts

    {exp:weblog:entries weblog='page'}
    
        {categories limit='1'}
            {embed='templates/_header' title='{title}' flash='true' category='{category_name}'}
        {/categories}
    
        {!-- more code --}
    
    {/exp:weblog:entries}

    I’m trying something out like this but it is loaded the templates per number of categories. Why is the limit parameter not working?

  • #2 / May 05, 2008 5:37pm

    Ingmar

    29245 posts

    What does

    {exp:weblog:entries weblog='page'}
    {categories limit='1'}
    {category_name}
    {/categories}
    {/exp:weblog:entries}

    yield?

  • #3 / May 05, 2008 5:41pm

    atealtha

    21 posts

    Like I said it loads the templates per category. That resulted in multiple category names being displayed (two in this case). The names are unique, not repeated.

  • #4 / May 05, 2008 5:48pm

    Ingmar

    29245 posts

    Well, I am suspecting a parse order issue, so I am trying to get rid of the {embed} for our test. What version and build are you on?

  • #5 / May 05, 2008 6:09pm

    atealtha

    21 posts

    I see. Well it’s a simple web page type of template with no caching or PHP enabled, and stored as a file.

    I am using ExpressionEngine 1.6.0 Build: 20070726

    I know the usual response is to upgrade EE. But it is not a reasonable option for little improvement because I had to hack so many core files to get additional functionality (I left this tag alone). If you or anyone else still has other approaches I would like to hear them.

  • #6 / May 05, 2008 6:16pm

    Ingmar

    29245 posts

    Yes, upgrading would be the way to go. You know why, actually? Because

    Added limit= parameter to Weblog Entries {categories} tag pair

    was only added with 1.6.1.

  • #7 / May 05, 2008 6:34pm

    atealtha

    21 posts

    Ahh well isn’t that just lovely.

    I found a work around, in case anyone is in my situation. But if you can, upgrading is a much better choice.

    {exp:weblog:entries weblog='page'}
        <?php $first = TRUE ?>
        {categories}
            <?php if ($first): ?>{embed='templates/_header' title='{title}' flash='true' category='{category_name}'}<?php endif ?>
            <?php $first = FALSE ?>
        {/categories}
    {/exp:weblog:entries}

    If anyone needs a certain number, this works. It’s kind of like a demented for loop.

    {exp:weblog:entries weblog='page'}
        <?php $i = 0; $limit = 10; ?>
        {categories}
            <?php if ($i++ < $limit): ?>
                {!-- code here --}
            <?php endif ?>
        {/categories}
    {/exp:weblog:entries}

    Thanks Ingmar Greil, for taking the time to help me out.

  • #8 / May 05, 2008 6:42pm

    Ingmar

    29245 posts

    My pleasure, not to mention my job 😊

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

ExpressionEngine News!

#eecms, #events, #releases