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.

The "if" conditional on first entry only in a normal weblog.

April 25, 2010 6:05pm

Subscribe [2]
  • #1 / Apr 25, 2010 6:05pm

    Simple problem, but I can’t seem to find a solution. I have a weblog page with article links running down the page. I want the first entry only to have an additional class of “first” appended to it. I’ve tried if count = 1, “count” == 1 and other variations, and I can’t get it to work. What should I use?

  • #2 / Apr 25, 2010 6:08pm

    Lisa Wess

    20502 posts

    Martin, try:

    <pre><code>
    {if count == "1"} class=“first” {/if}

  • #3 / Apr 25, 2010 6:22pm

    Thanks, Lisa. That worked. Is there a way to modify this a bit? The structure of the page is as follow:

    Category 1
    Article 1
    Article 2

    Category 2
    Article 1
    Article 2

    Category 3
    Article 1
    Article 2

    And so on. I’d like to retain the same effect for all Article 1 on the page, not just the very first one. Any ideas?

    Martin

  • #4 / Apr 26, 2010 1:31am

    John Henry Donovan

    12339 posts

    Martin,

    Take a look at the switch variable. It might be what you are looking for.

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

ExpressionEngine News!

#eecms, #events, #releases