7 Replies Latest reply on Dec 21, 2010 4:41 PM by zzipper7

    Nested Repeat Region (How to convert from table to list)

    eagle-waa Level 1

      Sorry, i am really no PHP hero :-(

      i created a menu with the "nested repeat region" wizzard. Now i want to change the HTML from TABLE to LIST.

      I thought i just need to delete <table>- and <td>-tags, replace <tr> with <ul> and that's it. (But ist's NOT!)

       

      This is my code:

       

      ------- START ----------------

       

       

      <ul id="nav">

            <?php do { ?>      

                <li><?php echo $row_master1waa_page_top['top_name']; ?></li>

       

              <?php

        if ($totalRows_master1waa_page_top>0) {

          $nested_query_detail2waa_page_sub = str_replace("123456789", $row_master1waa_page_top['id_top'], $query_detail2waa_page_sub);

          mysql_select_db($database_WAA);

          $detail2waa_page_sub = mysql_query($nested_query_detail2waa_page_sub, $WAA) or die(mysql_error());

          $row_detail2waa_page_sub = mysql_fetch_assoc($detail2waa_page_sub);

          $totalRows_detail2waa_page_sub = mysql_num_rows($detail2waa_page_sub);

          $nested_sw = false;

          if (isset($row_detail2waa_page_sub) && is_array($row_detail2waa_page_sub)) {

       

       

            do { //Nested repeat

      ?>

                <ul>

                  <li>  <?php echo $row_detail2waa_page_sub['sub_head']; ?></li>

                </ul>

                <?php

            } while ($row_detail2waa_page_sub = mysql_fetch_assoc($detail2waa_page_sub)); //Nested move next

          }

        }

      ?>

              <?php } while ($row_master1waa_page_top = mysql_fetch_assoc($master1waa_page_top)); ?>

      </ul>  

       

       

       

      ------- END -----

       

      The problem is located in line 3. the result is a list like this:

       

      <ul id="nav">

           <li>xxx</li>

           <li>xxx</li>

                <ul>

                      <li>xxx</li>

                      <li>xxx</li>

                </ul>

           <li>xxx</li>

      </ul>

       

      Of course it will not work. I need the nested list inserted like this:

       

       

      <ul id="nav">

           <li>xxx</li>

           <li>xxx

                <ul>

                      <li>xxx</li>

                      <li>xxx</li>

                </ul>

            </li>

           <li>xxx</li>

      </ul>

       

       

      Can someone please help me changing my code to get this result?