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.

Beginner problems

December 08, 2010 12:37pm

Subscribe [2]
  • #1 / Dec 08, 2010 12:37pm

    Tomas023

    7 posts

    I have a little beginner’s problems. I have a text line above all the goods that shows how many products there are.

    
    There are 
    {exp:weblog:entries weblog="products"}
    
    {total_results}
    
    {/exp:weblog:entries} 
    products
    

    And if i add two products, the text line says, There is 22 products.
    I have tryd {count} and then it says 12.

    Help appreciates

    [Mod Edit: Moved to the EECore Support forum]

  • #2 / Dec 15, 2010 1:34pm

    smartpill

    456 posts

    I have a little beginner’s problems. I have a text line above all the goods that shows how many products there are.

    
    There are 
    {exp:weblog:entries weblog="products"}
    
    {total_results}
    
    {/exp:weblog:entries} 
    products
    

    And if i add two products, the text line says, There is 22 products.
    I have tryd {count} and then it says 12.

    Help appreciates

    [Mod Edit: Moved to the EECore Support forum]

    What’s happening is the exp:weblog:entries tag loops through all entries. Since you have 2 entries the loop runs twice. So “count” will show you the “count” number for each entry, 1 and 2. total_results will also loop without limiting the tag so you get “2” twice. If you add another you’ll see “333”. So try either:

    {exp:weblog:entries weblog="products" limit="1"}

    adding the limit, or

    
    There are 
    {exp:weblog:entries weblog="products"}
    
    {if count == 1}{total_results}{/if}
    
    {/exp:weblog:entries} 
    products
    

    This will only show the total the first loop through and ignore after that.

  • #3 / Dec 20, 2010 9:29am

    Tomas023

    7 posts

    Thanks!!

    Maybe u now the answer to this..

    I have create a toolbox(gallery), When you drag the mouse over an image a larger picture comes up. This is the html code.

    <ul>
    <li>
    <a. href=“image/test/large.jpg” class=“preview”>image/test/small.jpg</a>
    </li>
    </ul>

    I’ve tried so my jquery/javascript works. But now i want to make it work with exp tags to it.

    This is how i like to do it. But its wrong, maybe u/someone can tell me?

    {exp:weblog:entries weblog="product" sort="desc"}
    <ul>
    <li>
    <a. href=”{product_large_image}” class=“preview”>{product_small_image}</a>.
    </li>
    </ul>
    {/exp:weblog:entries}

  • #4 / Dec 24, 2010 12:23pm

    smartpill

    456 posts

    Thanks!!

    Maybe u now the answer to this..

    I have create a toolbox(gallery), When you drag the mouse over an image a larger picture comes up. This is the html code.

    <ul>
    <li>
    <a. href=“image/test/large.jpg” class=“preview”>image/test/small.jpg</a>
    </li>
    </ul>

    I’ve tried so my jquery/javascript works. But now i want to make it work with exp tags to it.

    This is how i like to do it. But its wrong, maybe u/someone can tell me?

    {exp:weblog:entries weblog="product" sort="desc"}
    <ul>
    <li>
    <a. href=”{product_large_image}” class=“preview”>{product_small_image}</a>.
    </li>
    </ul>
    {/exp:weblog:entries}

    You’ll need to put the <ul> and </ul> outside of the weblog:entries tags or they will get repeated for each entry along with everything else. You can keep them in where you have them if you use:

    {if count == 1}<ul>{/if}
    and
    {if count == total_results}</ul>{/if}

    around them, but placing them outside the weblog:entries tags is the simpler approach.

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

ExpressionEngine News!

#eecms, #events, #releases