Customizing SMF > SMF Coding Discussion

Echoing a code left to right in columns

(1/8) > >>

Liam_michael:

--- Code: ---<div style="padding-top: 1em; padding-right: 1em; padding-bottom: 1em; padding-left: 1em; font-size: 0.9em; line-height: 15px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #ADADAD; border-right-color: #ADADAD; border-bottom-color: #ADADAD; border-left-color: #ADADAD; border-image: initial; background-color: #ECEDF3; background-attachment: initial; background-origin: initial; background-clip: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 1ex; margin-left: 0px; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; border-radius:5px; color: rgb(0, 0, 0); font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-position: initial initial; background-repeat: initial initial;">

<div class="windowbg">

<table><tr><td><a href="'.$scripturl.'?action=profile;u='.$mem['id'].'" class="ssi_membergroup" id="ssi_member_'.$mem['id'].'">'.$mem['name'].'</a> - Administrator</td><td>',empty

($memberContext[$mem['id']]['avatar']['image'])

? '<img src="'.$settings['images_url'].'/noavatar.gif" width="50" height="50" />' : '<img height="50" width="50" src="' . $memberContext[$mem['id']]['avatar']['href'] . '"  alt="'.$mem['name'].'" /></td></tr></table>';

   echo'<ul>';
   
   echo'<li>Get to know <a href="'.$scripturl.'?action=profile;u='.$mem['id'].'" class="ssi_membergroup" id="ssi_member_'.$mem['id'].'">'.$mem['name'].'</a></li>';
   
   if($mem['karmaTotal'] > 0)
   
   echo'
   
   <li>Reputation: <font color="green">'.$mem['karmaTotal'].'</font></li>';
   
   if($mem['karmaTotal'] < 0)
   
   echo'
   
  <li>Rep: <font color="red">'.$mem['karmaTotal'].'</font></li>';
 
  echo'
 
  <li>Posts: <font color="navy">'.$mem['post'].'</font></li>';
     
  echo'<li>Send a <a href="http://biology-forums.com/index.php?action=pm;sa=send;u='.$mem['id'].'">personal message</a></li>
 
<li>Best answer votes recieved: '.$mem['thank_you_post_became'].'</li>
 
 
  <li>Joined the team March 06, 2011</li>';

 
   
   echo'
   
   </ul></div></div>';
}
--- End code ---

I have the following code... Is it possible to have the div go left to right (2 columns), then go to the next line and again, go left to right. As opposed to going down one at a time?

Like so:

X X

X X

X X

Instead of:

X

X

X

Antechinus:
Have you got it running live somewhere? My brain doesn't work too well this time on a Saturday morning. :)

Liam_michael:
Thanks for the reply. I got it to look like this, a 1 row by 4 column mess!

http://biology-forums.com/index.php?action=Tester

I want it to present the data in columns. I know it has something to do with array_chunk, but I don't know how to use it :(


--- Code: ---echo' <table width="100%"><tr>';

//Well they want it echo so lets echo...
foreach ($membergroup as $mem) {
loadMemberData($mem['id']);
loadMemberContext($mem['id']);
global $memberContext;
echo '

<td width="50%"><div style="padding: 1ex; font-size: 0.9em; line-height: 15px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-color: #ADADAD; border-right-color: #ADADAD; border-bottom-color: #ADADAD; border-left-color: #ADADAD; border-image: initial; background-color: #ECEDF3; background-attachment: initial; background-origin: initial; background-clip: initial; margin-top: 0px; margin-right: 0px; margin-bottom: 1ex; margin-left: 0px; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; border-radius:5px; color: rgb(0, 0, 0); font-family: arial; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-position: initial initial; background-repeat: initial initial;">

<div class="windowbg">

<table width="100%"><tr><td><a href="'.$scripturl.'?action=profile;u='.$mem['id'].'" class="ssi_membergroup" id="ssi_member_'.$mem['id'].'"><span style="font-weight: bold; text-transform: capitalize;">'.$mem['name'].'</span></a>';

if(!empty($mem['flag']))

echo' <img src="http://biology-forums.com/Sources/shop/flag_images/'.$mem['flag'].'" alt="flag">';



if($groupid == 2 || $groupid == 3)

echo' - Moderator';

if($groupid == 13)

echo' - Trusted Seller';

if($groupid == 1)

echo' - Administrator';

if($groupid == 15)

echo' - Contributor of the Month';

if(!empty($mem['status']))

echo'<br /><small><b>Status:</b> <i>'.$mem['status'].'</i></small>';

echo'</td>

<td width="75" style="padding-left: 1ex; align: center;"><center>',empty

($memberContext[$mem['id']]['avatar']['image'])

? '<img src="'.$settings['images_url'].'/noavatar.gif" width="50" height="50" />' : '<img height="50" width="50" src="' . $memberContext[$mem['id']]['avatar']['href'] . '"  alt="'.$mem['name'].'" /></center></td></tr></table>';

   echo'<ul style="list-style-image:url(http://icons.primail.ch/bullets/c001.gif); padding-top: 0ex; margin-top: 0px;">';
   
   if($mem['karmaTotal'] > 0)
   {
   echo'<li><b>Reputation:</b> <font color="green">'.$mem['karmaTotal'].'</font></li>';
   }
   if($mem['karmaTotal'] < 0)
   {
   echo'<li><b>Reputation:</b> <font color="red">'.$mem['karmaTotal'].'</font></li>';
}
  echo'
 
<li><b>Posts:</b> <font color="navy">'.$mem['post'].'</font></li>
 

 
<li><b>Best answer votes recieved:</b> '.$mem['thank_you_post_became'].'</li>

<li><b>Points Earned:</b> '.$mem['money'].'</li>
   
<li><b>Team member since</b> ' . timeformat($mem['registered']). '</li>

<li><b>Last active</b> ' . timeformat($mem['login']). '</li>

<li>Send a <a href="http://biology-forums.com/index.php?action=pm;sa=send;u='.$mem['id'].'">personal message</a></li>';

echo'
   
   </ul></div></div></td>';
}
echo'</tr></table>';
--- End code ---

Antechinus:
Ok so do you want two rows of two user blocks per row or what? Not sure what the aim is here.

Liam_michael:

--- Quote from: Antechinus on April 06, 2012, 07:55:21 PM ---Ok so do you want two rows of two user blocks per row or what? Not sure what the aim is here.

--- End quote ---

I want the data to be presented in rows of 2 columns.

Instead of something like this:

1
2
3
4
5
6

I want this:

1 2
3 4
5 6

Navigation

[0] Message Index

[#] Next page

Go to full version