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.

{count} in channel entries tag nested inside custom module tag

August 21, 2012 9:36am

Subscribe [1]
  • #1 / Aug 21, 2012 9:36am

    Arazmus

    4 posts

    Hi All,

    I know that this {count} inside nested loops has been covered before but all that i have read is that you cannot use count inside a nested tag that also uses {count}, eg:

    {exp:channel:entries}
        {exp:channel:entries}
            {count}
        {/exp:channel:entries}
    {/exp:channel:entries}

    now that is simple to under stand, however i am using a custom built module that looks similar to the following:

    {exp:custom:module}
       {exp:channel:entries
          disable="category_fields|member_data"
          dynamic="no"
          limit="{lv_settings_display_limit}"
          orderby="title|entry_date"
          paginate="bottom"
          sort="asc|desc"
          search:cf_tour_code='={search_tourCodes}'
        } 
          {count}
        {/exp:custom:entries}
    {/exp:custom:module}

    the custom module only returns {search_tourCodes} and doesn’t have a {count}, but count is always displayed as 1

    any ideas? or is it that you cannot nest the entries tag inside any other tag?

  • #2 / Aug 21, 2012 10:10am

    Arazmus

    4 posts

    Hi All,
    I figured this out.. really should have read the template class docs better, but it turns out using:

    $output = $this->EE->TMPL->parse_variables(
                $this->EE->TMPL->tagdata,
                $variables
            );

    automatically gives you the {count} regardless of if you wanted it, so i changed that to:

    return  str_replace(LD.'riv_search_tourCodes'.RD, $TourCode,  $this->EE->TMPL->tagdata);

    and everything worked as expected.

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

ExpressionEngine News!

#eecms, #events, #releases