Announcement

Collapse
No announcement yet.

If FragmentText is empty add style to containg div

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    If FragmentText is empty add style to containg div

    My fragment is contained in a div:
    Code:
    <div class="col-md-12 product-details">
    
    <div class="thumbnail">
    <actinic:block if="%3cactinic%3avariable%20name%3d%22FragmentImageFileName%22%20%2f%3e%20%21%3d%20%22%22">
    <actinic:variable formatting="div,style|set-right" name="FragmentImage" />
    </actinic:block>
    <actinic:block if="%3cactinic%3avariable%20name%3d%22FragmentTitle%22%20%2f%3e%20%21%3d%20%22%22">
    <actinic:variable formatting="h2" name="FragmentTitle" />
    </actinic:block>
    <actinic:variable formatting="div,style|fragment-text" name="FragmentText" />
    <div class="clearfloat"></div>
    </div>
    </div>
    I want to hide the fragment if the Fragment Text is empty, but doing this causes errors:

    Code:
    <div class="col-md-12 product-details"<actinic:block if="%3cactinic%3avariable%20name%3d%22FragmentText%22%20%2f%3e%20%3d%3d%20%22%22"> style="display:none;"</actinic:block>>
    Is there a work around anyone can think of?

    Thank you
    Jonathan Chappell
    Website Designer
    SellerDeck Website Designer
    Actinic to SellerDeck upgrades
    Graphicz Limited - www.graphicz.co.uk

    #2
    This will generate the <div ...> tag:
    Code:
    <div class="col-md-12 product-details"
    <actinic:block php="true">
    $fragtext = <<<ENDOFCODE
    <actinic:variable name="FragmentText" />
    ENDOFCODE;
    if ( strlen($fragtext) == 0 ) echo ' style="display:none;"';
    </actinic:block>
    >
    Note that this code must not be indented.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Thank you so much Norman. Best wishes.
      Jonathan Chappell
      Website Designer
      SellerDeck Website Designer
      Actinic to SellerDeck upgrades
      Graphicz Limited - www.graphicz.co.uk

      Comment

      Working...
      X