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 body not empty and comments allowed (Code?)

May 08, 2008 8:45am

Subscribe [2]
  • #1 / May 08, 2008 8:45am

    simsa

    14 posts

    Hi there,

    i like to code something like:
    if body !=”” AND comments_allowed

    i played around and tryed some conditionals to no avail, i did even try

    {if body !="" AND if_allow_comments==TRUE}

    how can i get this to work?

  • #2 / May 08, 2008 8:53am

    Ingmar

    29245 posts

    Why, you could simply nest them:

    {if allow_comments}
       {if body != ""}
    
          ...
    
       {/if}
    {/if}
  • #3 / May 08, 2008 9:36am

    simsa

    14 posts

    Thanks Ingmar.
    I did not know that you can nest conditionals so easily. My fault probably was using if_allow_comments instead of
    if allow_comments.

    However i did solve my inlined Read more link problem. I use Textile and with Textile you avoid sourrounding a paragraph with tags when inserting a whitespace at the beginning of the paragraph. Instead you can insert
    p.
    Lorem ipsum….more text

    on the html sourcecode one can use

    {if body !=""}{body}{if:else}{summary}{/if}
    {if summary !=""}<span class="read-more"><a href="http://{homepage}/{my_template_group}/artikel/{url_title}">Read more…</a></span>{/if}
    {if body !=""}{if allow_comments}<span><a href="http://{url_title_path=">Comment</a></span>{/if}{/if}

    It´s not the nicest solution though..

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

ExpressionEngine News!

#eecms, #events, #releases