Announcement

Collapse
No announcement yet.

Arrays in layoutlist

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

    Arrays in layoutlist

    I have created an array for a drop down product choice which is populated by UDV's.

    The layout for the iterating list is :

    'UDVname',

    The rest of the array function sits at the ListStart and ListEnd fields.

    This works fine apart from the last value should not have the "," before the close of the array. I have tried all manner of block if's around the "," eg

    ListIndex < ListCount all to no avail

    The above worked in v9 but ugrading to v11 causes the final "," to be added. I know Norman had issues with ListIndex & ListCount previously and wondered if something has crept into v11.

    Anyways - is there a way to add the "," unless the iteration is the last in the array?


    Bikster
    SellerDeck Designs and Responsive Themes

    #2
    Where and when ListCount works is a can of worms. Actinic seem reluctant / unable to fix it.

    I often use a preliminary PHP loop kludge.
    E.g.
    Code:
    <actinic:block php="true">
      <actinic:block type="MyList">
        $truelistcount = <actinic:variable name="ListIndex" selectable="false" />;
      </actinic:block>
    </actinic:block>
    
    <!-- now the real loop -->
    <actinic:block type="MyList">
      do something
      <actinic:block php="true">
        if ( <actinic:variable name="ListIndex" selectable="false" /> < $truelistcount ) echo ",";
      </actinic:block>
    </actinic:block>
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Cheers Norman - a cracking fudge.

      Appreciate your code was typed untested so the following is the corrected version which worked a peach should anyone be reading this thread:

      Code:
      <actinic:block php="true">
        <actinic:block type="MyList">
          $truelistcount == <actinic:variable name="ListIndex" selectable="false" />;
        </actinic:block>
      </actinic:block>
      
      <actinic:block type="MyList">
      do something
      <actinic:block php="true">if ( <actinic:variable name="ListIndex" selectable="false" /> < $truelistcount ) echo ",";</actinic:block>
      </actinic:block>
      Changes were :

      $truelistcount ==
      selectable="false" to the PHP variables

      If Actinic are watching a fix to the ListIndex / ListCount would be great as this is a powerful hidden gem.

      Cheers again Norman


      Bikster
      SellerDeck Designs and Responsive Themes

      Comment


        #4
        That == is wrong. Should be a single =
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          It would not work with the single "=" ... adding in the "==" sorted it

          Fixed and online at http://www.barrelsandbottles.co.uk/a...champagne.html

          Select an option from the drop down "Select a Design" in the right column and the main image changes accordingly.

          That product also features your multi other info prompt which is worth its weight in gold


          Bikster
          SellerDeck Designs and Responsive Themes

          Comment


            #6
            I assure you that a line

            $truelistcount == <actinic:variable name="ListIndex" selectable="false" />;

            is operationally meaningless as it's a comparison operation used in isolation and won't set any variables. So $truelistcount will be undefined when you use it later.

            We are trying to get the final value of ListIndex into variable $truelistcount and you need an assignment operator which is what "=" is!

            Without seeing the actual code you're using I can't explain why you think it's working when it cannot be. Perhaps the final value you've added to these lists 'internet-design.jpg' is making it work.
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              You also have a problem with your How to complete the form link.

              It's inadvertently clearing the main page when the popup loads.

              Perhaps this is code from an earlier version of Actinic that the upgrader has missed.

              Current V11 way to open an Extended Info page from a text link is:
              Code:
              <a href="<actinic:variable name="ExtendedInfoPageEncoded" />" target="ActPopup" onclick="return ShowPopUp('<actinic:variable name="ExtendedInfoPageEncoded" />',<actinic:variable name="ExtInfoWindowWidth" />,<actinic:variable name="ExtInfoWindowHeight" />);">
              However this will cause Google, etc to index your popup pages. If these aren't full fat pages with navigation they'll be of no use to anyone. In such cases better code would be:
              Code:
              <a href="javascript:void(0)" onclick="ShowPopUp('<actinic:variable name="ExtendedInfoPageEncoded" />',<actinic:variable name="ExtInfoWindowWidth" />,<actinic:variable name="ExtInfoWindowHeight" />);">
              Norman - www.drillpine.biz
              Edinburgh, U K / Bitez, Turkey

              Comment


                #8
                Cheers for the spot on the pop-up script ... this was indeed previously in v9 before jumping to v11

                I have fixed and uploading the array which I got to work after a bit of tribulation .... having an non standard character in a filename did not help but also setting your first block into the ListStart rather than the list itself did the business and is correctly populating the commas in the array


                Bikster
                SellerDeck Designs and Responsive Themes

                Comment

                Working...
                X