Announcement

Collapse
No announcement yet.

Bug: Lists processed in unusual sequence.

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

    Bug: Lists processed in unusual sequence.

    Using 8.5.1.HIZA. Probably affects all other V8+ versions.

    I've noticed that when a List is being generated the code in Start of List, the List items themselves and the code in End of List are not being processed in the expected sequence.

    I'd expect

    Start of List
    List Items
    End of List

    However what actually happens seems to be in this sequence

    List Items HTML generated to a buffer
    Start of List HTML generated to a buffer
    End of List HTML generated to a buffer

    Then the Start, List and End lumps of HTML are concatenated to make a single big lump of HTML which is used on the page.

    The result is that the HTML appears as you'd expect but there are undesirable side effects.

    Extremely strange things happen if you want to use PHP in your code. It seems natural to initialise a variable in Start of List and expect it to be available within the List and the final value to be available in End of List. That doesn't happen due to the out-of-order parsing mentioned above.

    I've tested this on Product Lists and Section Lists and get the same bizarre behaviour on both.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    #2
    *sigh*

    i'v tested this and he's right you know. Nice collection of buglettes you have there. I ahve been working on some code that parses these dropdowns for some ajax work. This bug causes holy hell in scripts.

    Comment


      #3
      Here's a test showing what seems to be happening:
      Code:
      <!-- Put this outside and before the List -->
      <actinic:block php="true">
      $xyz = 100;
      echo  "Outside Before List: $xyz<br>";
      </actinic:block>
      
      
      <!-- Put this in Start of List -->
      <actinic:block php="true">
      echo " In Start of List: $xyz <br>";
      $xyz = 200;
      echo "Started: $xyz <br>";
      </actinic:block>
      
      
      <!-- Put this inside the List -->
      <actinic:block php="true">
      $xyz += 1;
      echo  "Inside List: $xyz <br>";
      </actinic:block>
      
      
      <!-- Put this in End of List -->
      <actinic:block php="true">
      echo  "In End of List: $xyz <br>";
      $xyz += 10;
      </actinic:block>
      
      <!-- Put this outside and after the List -->
      <actinic:block php="true">
      echo  "Outside After List: $xyz<br>";
      </actinic:block>
      Now if the list had 3 items we'd expect:

      Outside Before List: 100
      In Start of List 100
      Started: 200
      Inside List: 201
      Inside List: 202
      Inside List: 203
      In End of List: 203
      Outside After List: 213

      But what we get is:

      Outside Before List: 100
      In Start of List 103
      Started: 200
      Inside List: 101
      Inside List: 102
      Inside List: 103
      In End of List: 200
      Outside After List: 210
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


        #4
        Now the kludgy fix is never to put any PHP that sets a variable that you want to use within a list into the Start of List or End of List entries.

        Put it outside the line that calls the list and all will be well (but makes for lousy management as you'll have to find all instances of such calls and cannot edit code that's meant to work together all in the same layout).

        You could also put the initialising code within the list surrounded by

        if ListIndex == 1

        but you cannot do this for the end of list as ListIndex == ListCount has a different bug in it that makes it unusable at present.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Thanks for the info guys. I have reported this to the development team

          Comment

          Working...
          X