3 Column repeat region? {DW}

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jefferis NoSpamme

    #1

    3 Column repeat region? {DW}

    [FYI:I'm using Dreamweaver 2004 for my interface. ]


    I don't have a problem laying out a recordset in php/mysql, but each record
    is returned in a single row in a table file.
    Is there a way to return say 3 images and descriptions in a 3 column list
    instead? I mean I'd like the repeating region to be horizontal for three
    records, e.g., rather than merely one repeating row for each item.

    Thanks
    Jeff




    ~~~~~~~~~~~~
    Jefferis Peterson, Pres.
    Web Design and Marketing




    ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
  • Geoff Berrow

    #2
    Re: 3 Column repeat region? {DW}

    I noticed that Message-ID: <BE2932D9.11712 %jefferisp7@hot mail.com> from
    Jefferis NoSpamme contained the following:
    [color=blue]
    >I don't have a problem laying out a recordset in php/mysql, but each record
    >is returned in a single row in a table file.
    >Is there a way to return say 3 images and descriptions in a 3 column list
    >instead? I mean I'd like the repeating region to be horizontal for three
    >records, e.g., rather than merely one repeating row for each item.[/color]

    Not sure how DW would tackle this but let's consider the code. For
    three columns you need:

    <tr><td>descrip tion</td><td>image</td>

    then

    <td>description </td><td>image</td>

    then

    <td>description </td><td>image</td></tr>

    Notice the differences?

    The bit in the middle stays the same, only the ends change.
    Suppose we define two arrays
    $s=array("<tr>" ,"","");
    $e=array("","", "</tr>"

    Then something like

    $s[0]<td>description </td><td>image</td>$e[0]

    $s[1]<td>description </td><td>image</td>$e[1]

    $s[2]<td>description </td><td>image</td></tr>$e[2]

    Should do what we want.

    Finally you just need a method of generating those array indices.
    Start by initialising a counter
    $i=0;

    Clearly, for the first row you have
    $s[$i]<td>description </td><td>image</td>$e[$i]

    But $i needs to increment before we get the next row (but go back to
    zero every third row)

    So..

    $i++;
    if($i>2){$i=0;}


    All you have to do is put it together...





    --
    Geoff Berrow (put thecat out to email)
    It's only Usenet, no one dies.
    My opinions, not the committee's, mine.
    Simple RFDs http://www.ckdog.co.uk/rfdmaker/

    Comment

    • Jefferis NoSpamme

      #3
      Re: 3 Column repeat region? {DW}

      Hi Geoff,
      Maybe this will work, but the trouble I'm having is more in line with how
      the MySQL queries are displayed as a result of repeated regions. The code
      below may clarify the problem:


      On 2/4/05 3:11 PM, in article k5j701912pn9sg6 8tunm5aaps9l5rq 2q4g@4ax.com,
      "Geoff Berrow" <blthecat@ckdog .co.uk> wrote:
      [color=blue]
      > $s[0]<td>description </td><td>image</td>$e[0]
      >
      > $s[1]<td>description </td><td>image</td>$e[1]
      >
      > $s[2]<td>description </td><td>image</td></tr>$e[2]
      >
      > Should do what we want.
      >
      > So..
      >
      > $i++;
      > if($i>2){$i=0;}
      >
      >[/color]

      Let me give you some of the code and the query at the bottom.
      The display table:
      <table width="550" border="2" align="center" cellpadding="0" cellspacing="1"
      bordercolor="#3 33333">
      <tr>
      <td width="50%">
      <div align="center">
      <p><?php echo $row_viewall['descrip']; ?> </p>
      ....
      <?php echo $row_viewall['item_name']; ?>" border="0"></a><br>
      <?php echo $row_viewall['designer']; ?>
      <br>
      <?php echo $row_viewall['item']; ?></div></td>
      </tr>
      </table>
      <?php } while ($row_viewall = mysql_fetch_ass oc($viewall)); ?>
      The query is set up to display info linked to the database row.

      The Query:

      ~~~~~~~~~~~~~~

      $maxRows_viewal l = 5;
      $pageNum_viewal l = 0;
      if (isset($_GET['pageNum_viewal l'])) {
      $pageNum_viewal l = $_GET['pageNum_viewal l'];
      }
      $startRow_viewa ll = $pageNum_viewal l * $maxRows_viewal l;

      mysql_select_db ($database_jode nonline, $jodenonline);
      $query_viewall = "SELECT * FROM `Catalog` WHERE `Catalog`.img_s tatus = '1'
      AND `Catalog`.desig ner Like '%Victorian%' ORDER BY `Catalog`.sold ASC";
      $query_limit_vi ewall = sprintf("%s LIMIT %d, %d", $query_viewall,
      $startRow_viewa ll, $maxRows_viewal l);
      $viewall = mysql_query($qu ery_limit_viewa ll, $jodenonline) or
      die(mysql_error ());
      $row_viewall = mysql_fetch_ass oc($viewall);

      if (isset($_GET['totalRows_view all'])) {
      $totalRows_view all = $_GET['totalRows_view all'];
      } else {
      $all_viewall = mysql_query($qu ery_viewall);
      $totalRows_view all = mysql_num_rows( $all_viewall);
      }
      $totalPages_vie wall = ceil($totalRows _viewall/$maxRows_viewal l)-1;

      $queryString_vi ewall = "";
      if (!empty($HTTP_S ERVER_VARS['QUERY_STRING'])) {
      $params = explode("&", $HTTP_SERVER_VA RS['QUERY_STRING']);
      $newParams = array();
      foreach ($params as $param) {
      if (stristr($param , "pageNum_viewal l") == false &&
      stristr($param, "totalRows_view all") == false) {
      array_push($new Params, $param);
      }
      }
      if (count($newPara ms) != 0) {
      $queryString_vi ewall = "&" . implode("&", $newParams);
      }
      }
      $queryString_vi ewall = sprintf("&total Rows_viewall=%d %s",
      $totalRows_view all, $queryString_vi ewall);
      ?>

      ~~~~~~~~~~~~
      Jefferis Peterson, Pres.
      Web Design and Marketing




      ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
      http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
      ----= East and West-Coast Server Farms - Total Privacy via Encryption =----

      Comment

      • Geoff Berrow

        #4
        Re: 3 Column repeat region? {DW}

        I noticed that Message-ID: <BE296619.1188B %jefferisp7@hot mail.com> from
        Jefferis NoSpamme contained the following:
        [color=blue]
        >Maybe this will work, but the trouble I'm having is more in line with how
        >the MySQL queries are displayed as a result of repeated regions. The code
        >below may clarify the problem:[/color]

        You need to understand how this works. The query returns rows and the
        while loop iterates through the rows. While you are simply displaying
        rows as table rows the code can be the same each time. To save it in
        groups of three means that the region needs to change each row of the
        iteration.

        --
        Geoff Berrow (put thecat out to email)
        It's only Usenet, no one dies.
        My opinions, not the committee's, mine.
        Simple RFDs http://www.ckdog.co.uk/rfdmaker/

        Comment

        • Jefferis NoSpamme

          #5
          Re: 3 Column repeat region? {DW}

          Is is possible to change each region without calling in an overlapping
          display of the items? Everything seems to be structured by the WHILE to call
          each record sequentially. While it might be possible to call items by row
          and column, the WHILE statement would create columns infinitely to the end
          of the query unless bounded.
          Dreamwweaver is no help in structuring this query and display because it
          defaults to sequential rows. Since the database itself is structured by row
          per item, a column data call might get really hairy.
          I just can't think of how this layout might be done.

          Thanks
          Jeff


          On 2/4/05 6:20 PM, in article 660801thlhcnffq cjbu55rian97q77 ucqk@4ax.com,
          "Geoff Berrow" <blthecat@ckdog .co.uk> wrote:
          [color=blue]
          > You need to understand how this works. The query returns rows and the
          > while loop iterates through the rows. While you are simply displaying
          > rows as table rows the code can be the same each time. To save it in
          > groups of three means that the region needs to change each row of the
          > iteration.[/color]

          ~~~~~~~~~~~~
          Jefferis Peterson, Pres.
          Web Design and Marketing




          ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
          http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
          ----= East and West-Coast Server Farms - Total Privacy via Encryption =----

          Comment

          • Jefferis NoSpamme

            #6
            Re: 3 Column repeat region? {DW}

            Hey Geoff,
            I think this $e array would not work properly. You have the $e at the end of
            each $s, but that would create a new row after each image/description pair.
            The <tr> has to be outside each set of 3 returned items.

            For simplicity's sake, let's just use 1 item in a cell, called item
            name.The record set query is calling 100 items, say.

            <tr>
            <?php do { ?>

            <td >
            <?php echo $row_RecordSet1['item_name']; ?>
            </td>

            <?php } while ($row_RecordSet 1 = mysql_fetch_ass oc($RecordSet1) ); ?>
            </tr>

            And I have maximum records per page:
            $maxRows_Record Set1 = 9;


            I keep trying to create a for while loop, but I'm getting stumped.

            Jeff

            On 2/4/05 3:11 PM, in article k5j701912pn9sg6 8tunm5aaps9l5rq 2q4g@4ax.com,
            "Geoff Berrow" <blthecat@ckdog .co.uk> wrote:
            [color=blue]
            >
            > Notice the differences?
            >
            > The bit in the middle stays the same, only the ends change.
            > Suppose we define two arrays
            > $s=array("<tr>" ,"","");
            > $e=array("","", "</tr>"
            >
            > Then something like
            >
            > $s[0]<td>description </td><td>image</td>$e[0]
            >
            > $s[1]<td>description </td><td>image</td>$e[1]
            >
            > $s[2]<td>description </td><td>image</td></tr>$e[2]
            >
            > Should do what we want.
            >
            > Finally you just need a method of generating those array indices.
            > Start by initialising a counter
            > $i=0;
            >
            > Clearly, for the first row you have
            > $s[$i]<td>description </td><td>image</td>$e[$i]
            >
            > But $i needs to increment before we get the next row (but go back to
            > zero every third row)
            >
            > So..
            >
            > $i++;
            > if($i>2){$i=0;}[/color]
            ~~~~~~~~~~~~
            Jefferis Peterson, Pres.
            Web Design and Marketing




            ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
            http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
            ----= East and West-Coast Server Farms - Total Privacy via Encryption =----

            Comment

            • Geoff Berrow

              #7
              Re: 3 Column repeat region? {DW}

              I noticed that Message-ID: <BE2D3AF7.11DE3 %jefferisp7@hot mail.com> from
              Jefferis NoSpamme contained the following:
              [color=blue]
              >I think this $e array would not work properly. You have the $e at the end of
              >each $s, but that would create a new row after each image/description pair.[/color]

              No it wouldn't because it's an array
              $s=array("<tr>" ,"","");
              $e=array("","", "</tr>"

              $e[0] is empty.
              $e[1] is empty
              only$e[2] contains the </tr>

              --
              Geoff Berrow (put thecat out to email)
              It's only Usenet, no one dies.
              My opinions, not the committee's, mine.
              Simple RFDs http://www.ckdog.co.uk/rfdmaker/

              Comment

              • Jefferis NoSpamme

                #8
                Re: 3 Column repeat region? {DW}

                Doh!

                :-)



                On 2/7/05 3:55 PM, in article 6jkf01to0c4bid7 ut96n0gcartbufd 0c9u@4ax.com,
                "Geoff Berrow" <blthecat@ckdog .co.uk> wrote:
                [color=blue]
                > No it wouldn't because it's an array
                > $s=array("<tr>" ,"","");
                > $e=array("","", "</tr>"
                >
                > $e[0] is empty.
                > $e[1] is empty
                > only$e[2] contains the </tr>[/color]

                ~~~~~~~~~~~~
                Jefferis Peterson, Pres.
                Web Design and Marketing




                ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
                http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
                ----= East and West-Coast Server Farms - Total Privacy via Encryption =----

                Comment

                Working...