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.

IF Conditional for "not a single entry page"

January 07, 2010 2:32am

Subscribe [1]
  • #1 / Jan 07, 2010 2:32am

    GuanoLad

    5 posts

    I am completely new to EE, so I am still struggling like a newbie as I make my way through each feature. Expect a lot of stupid questions from me over the coming weeks.

    Here’s where I’m currently stuck:

    I have styled a div to enclose the comments that show up on a single entry page. If I place the div inside the {exp:comment:entries} then it will wrap each comment individually. I don’t want that. I want the div to enclose the whole list of comments.

    But when I put the div outside the {exp:comment:entries} tag to achieve that, which looks great on the single entry page, there is a problem. The div shows up on my main blog page as an empty rectangle.

    So, thinks I, what I need is a conditional that effectively says “If this is not a single entry page, then don’t display” which is what the {exp:comment:entries} does in itself, but I can’t figure out how to do it for my CSS.

    I am somewhat lost on how to solve my problem. I may be stuck.

  • #2 / Jan 07, 2010 4:55am

    You could use php to check the url of the page to see if you’re on the frontpage or not.

    Even better would be to use EE’s segment variables for this:
    http://expressionengine.com/docs/templates/globals/url_segments.html

    Or you could just use 2 different (template) pages for your frontpage and your single entry page.
    ( which is what I would do 😊 )

  • #3 / Jan 07, 2010 9:47am

    ender

    1644 posts

    {exp:comment:entries ... }
      {if count == 1}<div>{/if}
      ...
      {if count == total_results}</div>{/if} 
    {/exp:comment:entries}
  • #4 / Jan 07, 2010 6:37pm

    GuanoLad

    5 posts

    Woohoo! Excellent, works perfectly!

    Thanks. I would never have figured this out on my own.

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

ExpressionEngine News!

#eecms, #events, #releases