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.

Comment Help Please

December 18, 2010 12:47pm

Subscribe [4]
  • #1 / Dec 18, 2010 12:47pm

    anoopbal

    152 posts

    Hi everyone,

    I treid to add avatars to my comments. Change my code and my div aren’t lining up anymore in the comments section.

    My comment code is in a different template so I am sure it is the problem in that template. Can someone plase take a look and see what is wrong.

    I am guessing I screwed the conditional If rule or putting a Div in ther wrong place: the place where I think i screwed up I used the code tag. Here is sample article page

    {exp:comment:entries}
    
    {if email == "anoo…[email protected]"}
    <div class="myentry">
     <span class="myname"> {name} </span> | <span class="date">{comment_date format="%D %F %d, %Y at %g:%i %a "}</span>
    
    {/if}
    {if email != "anoo…[email protected]"}
    <div class="entry">
     <span class="commentname"> {name}</span> | <span class="date">{comment_date format="%D %F %d, %Y at %g:%i %a "}</span>
    {/if}
    {comment}
    </div>
    
    {/exp:comment:entries}
    </div>
  • #2 / Dec 19, 2010 3:34pm

    Greg Salt

    3988 posts

    Hi anoopbal,

    Your code above is wrong - you need to close divs within conditionals and you have trailing div closures after the comment and comment:entries tags - but it looks like you’ve figured it out since your article page is rendering correctly?

    Cheers

    Greg

  • #3 / Dec 19, 2010 3:49pm

    anoopbal

    152 posts

    I somehow got it. Thanks!!

    what do you mean by having conditional in div please?

  • #4 / Dec 20, 2010 3:52pm

    Ingmar

    29245 posts

    Greg meant that you shouldn’t split parts of your code across multiple conditional branches, i.e. have

    {if foo != ""}
       <div> ... </div>
    {/if}

    instead of

    {if foo != ""}
       <div> ... 
    {/if}
    </div>

    Makes sense?

  • #5 / Dec 20, 2010 9:31pm

    anoopbal

    152 posts

    Hi Greg,

    But I have 2 if conditionals and one comment. Ho will you write the code I had with the way you suggested.

    Thanks so much!

  • #6 / Dec 21, 2010 3:23pm

    Ingmar

    29245 posts

    Just pull the closing divs inside the conditional branches, like so:

    {exp:comment:entries}
    
    {if email == "anoo…[email protected]"}
    <div class="myentry">
     ...
    </div>
    {/if}
    
    {if email != "anoo…[email protected]"}
    <div class="entry">
     ...
    </div>
    {/if}
    {comment}
  • #7 / Dec 23, 2010 6:16pm

    anoopbal

    152 posts

    I tried but it didn’t work. When I use the code given, I don’t see my comment.

  • #8 / Dec 27, 2010 2:01pm

    Brandon Jones

    5500 posts

    Hi anoopbal,

    In these cases the best thing to do is start with a very basic template and get your conditionals working there, then slowly add in the rest. I’d also validate your output to make sure the markup is correct. More than likely you’ve got an error in your template, but if you still can’t find it, post the basic, stripped-down template that doesn’t work for you here.

  • #9 / Dec 27, 2010 2:21pm

    anoopbal

    152 posts

    Thanks!! I will try it and let you know.

    Even if I don’t get it right, I think the customer service is really exemplary. That’s one good reason to stick with EE!

  • #10 / Dec 27, 2010 7:34pm

    Brandon Jones

    5500 posts

    No problem, anoopbal! We’ll be here.

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

ExpressionEngine News!

#eecms, #events, #releases