Announcement

Collapse
No announcement yet.

Change fragment layout based on fragment title

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

    Change fragment layout based on fragment title

    I need to be able to change the fragment layout depending on the title.

    I have tried a BlockIf and it does not work.

    I have done a new design for a client site with lots of fragments with products.

    Some fragments are just images so I would like a simple way of changing the fragment layout content if the fragment image begins with 'Img'
    Is this possible with PHP or js?

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

    #2
    Make individual Fragment Layouts "Fragment Layout 1", "Fragment Layout 2", "Fragment Layout 3". Or use your existing layouts instead below.

    Make a fragment layout "Dynamic Fragment Layout" that contains:
    Code:
    <actinic:block if="%3cactinic%3avariable%20name%3d%22FragmentTitle%22%20%2f%3e%20%3d%3d%20%22One%22">
    	<actinic:variable name="FragmentLayoutRWD" value="Fragment Layout 1" />
    </actinic:block>
    
    <actinic:block if="%3cactinic%3avariable%20name%3d%22FragmentTitle%22%20%2f%3e%20%3d%3d%20%22Two%22" >
    	<actinic:variable name="FragmentLayoutRWD" value="Fragment Layout 2" />
    </actinic:block>
    
    <actinic:block if="%3cactinic%3avariable%20name%3d%22FragmentTitle%22%20%2f%3e%20%3d%3d%20%22Three%22" >
    	<actinic:variable name="FragmentLayoutRWD" value="Fragment Layout 3" />
    </actinic:block>
    And use "Dynamic Fragment Layout" for your fragments and it will display using one of the sub-layouts depending on whether the fragment title is One, Two or Three.

    You can use some PHP functions in BlockIf's e.g.
    Code:
    stristr(<actinic:variable name="FragmentTitle" />, "hello") !== false
    Will be true if the word "hello" is anywhere in the title.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Amazing - thank you so much Norman - I was about to start venturing into the database but I much prefer to keep everything in the software.

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

      Comment


        #4
        Some fragments are just images
        A BlockIf containing:

        (FragmentImageFileNameRaw != "") && (FragmentText == "")

        will detect fragments with only an image.



        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          It gets better and better! I am using it in all sorts of ways to cope with multiple layoutrs and mixes of hard coding etc. It is an incredible piece of kit.

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

          Comment

          Working...
          X