Announcement

Collapse
No announcement yet.

Picking Layouts inside PHP Blocks

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

    Picking Layouts inside PHP Blocks

    I am attempting and failing at present in getting Actinic to use a certain layout (that contains Lists) based on a value inside of a PHP block, the scenario is as follows:

    Basic PHP to use a layout can be achieved with:

    echo "Actinic-Layout-Name";

    and so long as the layout has basic info in it then it displays fine, but anything more complicated including section and product lists it just errors out each and every time.

    Have tried assigning different encoding and condition assignments to the layout within my echo, but same bad result each time.

    Anyone any pearls of wisdom on this one.

    Thx Ian

    #2
    Are you over engineering perhaps, sounds on the surface that simple actinic blockifs will do what you want, even if you need to create a variable as their switch? Can't see why you need php in the way you are?

    Comment


      #3
      Hi Lee,

      Yeh I know, but here is the spanner in the works from what I have tried.

      So, whilst in a section I need a blockif that can say:

      Has Sub-Section = Yes and Has Product of 2 or more = Yes: Show layout 1
      Has Sub-Section = No and Has Product of 1 = Yes: Show layout 2
      Has Sub-Section = Yes and Has Products of 0 = Yes: Show layout 3

      And so on......

      Driving me insane this one LOL.

      Ian
      PS: Variable as a switch is not possible, which is why trying to read the sub sections and products in the section etc.

      Comment


        #4
        Dude, that's way too complicated for me to be looking at this late, my head has just switched off. Have a look at this for reference though, sure some or all of this will be helpful - http://community.actinic.com/showthread.php?t=49000 .

        Don't forget the actinic set blocks (you might not have anyway) for instance on childsectionlist, productlist etc. Combining those with the above must get you close. You then have listindex and listcount variables too, don't forget those.

        Also an inbuilt condition 'hasvisibleproduct' or something like that.

        Apologies if i am just saying things you know about and being a chocolate fireguard.

        Comment


          #5
          Use PHP's heredoc syntax:
          Code:
          <actinic:block php="true">
            $layoutcode = <<<ENDOFLAYOUT
          <actinic:variable name="AnyOldLayout" />
          ENDOFLAYOUT;
            echo $layoutcode;
          </actinic:block>
          Note that the ENDOFLAYOUT; line must start the line. No indentation allowed.
          Norman - www.drillpine.biz
          Edinburgh, U K / Bitez, Turkey

          Comment


            #6
            Just the ticket - thanks for the reminder Norman, used that little beauty before and just forgot (must have been what, 2 plus years ago lol).

            Thanks again, Ian

            Comment

            Working...
            X