Current location: Hot Scripts Forums » Programming Languages » PHP » Display repeat regions horizontally?


Display repeat regions horizontally?

Reply
  #1 (permalink)  
Old 03-31-05, 05:36 AM
godonholiday godonholiday is offline
Newbie Coder
 
Join Date: Feb 2005
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
Display repeat regions horizontally?

Hi how do i get my repeat regions from dynamic tables to display across the page.

on somepages i want two per line and on others i want three or four?

at the minute they are listed down the page??

thanks in advance
g
Reply With Quote
  #2 (permalink)  
Old 03-31-05, 07:46 AM
koncept
Guest
 
Posts: n/a
i'll let you look at the asp version bc im not sure of the syntax for php but the theory is the same

Code:
 'varialbes
 const intNoPerRow = 2
 dim intCatCount
 dim intTotCats
 
 <% if not rsStore.eof then %>
 ^^- if there are records in the database continue running script
 <table width="100%" border="0" cellpadding="3" cellspacing="3">
 			  <tr>
 <%
 'loop for getting all records from database
   do while not rsStore.eof
 %>
 	  <td><div align="center">this is the stuff that will be repeated across page</div></td>
 <%
 	  intCatCount = intCatCount + 1
 intcatcount stores the number of columns in the current row
 	  if intCatCount = intNoPerRow then
 check if we are at our max per row now, if we are start new row
 %>
   </tr><tr>
 <%
 		intCatCount = 0
 'reset counter for columns
 	  end if
 	rsstore.movenext
   loop
 %>
 </table>
 <%end if%>
the <% is the same as your <?php and %> is the php close tag

i can explain in more detail if necessary
Reply With Quote
  #3 (permalink)  
Old 03-31-05, 07:55 AM
godonholiday godonholiday is offline
Newbie Coder
 
Join Date: Feb 2005
Posts: 64
Thanks: 0
Thanked 0 Times in 0 Posts
hmm a bit new

hi thanks for that, im a little new so will have to take some time to figure out the similarities and giveit a go.

thanks again
g
Reply With Quote
  #4 (permalink)  
Old 03-31-05, 09:45 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
with a for() loop you could do that.. see this for example:
PHP Code:

$array = array(12,,5);


for (
$i 0$i count($array); $i++) {
    echo 
$array[$i];

    if (isset(
$array[++$i]))
        echo 
$array[$i] <br />";
    else
        break;

not the best code, but it will print 2 elements in a line..

* NeverMind is exhasted and sleepy
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]

Last edited by NeverMind; 03-31-05 at 09:49 AM.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
display images in a datagrid or table from mysql database. bin ASP 1 01-03-05 06:34 PM
How to display from $a line to $z line ? websnow PHP 6 12-22-04 05:34 PM
display (radio)form along with selected values. al22 ASP 1 10-14-04 03:11 PM
Image display based on URL rjwebgraphix PHP 5 09-09-04 08:02 AM
If date is less than today do not display jimthepict ASP 5 10-19-03 10:43 PM


All times are GMT -5. The time now is 05:39 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.