foreach pagination

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
seuntech
Forum Newbie
Posts: 13
Joined: Thu Feb 24, 2011 4:54 pm

foreach pagination

Post by seuntech »

bellow is the code i have
please i will like to paginate it
i user count($maillist) to get total number of mail

Code: Select all

			<?foreach($maillist as $m) {
				if (!is_array($m))
					continue;

				$i++;
				if (is_int($i/2)){
					$c = 'class="shade';}
				else
					{$c = 'class="noshade';}

				if ($m['new']){
					$c .= ' new"';}
				else
					{$c .= '"';}

				$l = "{$_SERVER['PHP_SELF']}?p_a=97&page=mail_view&msgno={$m['msgno']}&folder={$_GET['folder']}";
				$l2 = "window.location.href='$l'" ; ?>
				<tr <?=$c?>>
					<td onclick="<?=$l2?>" class="flags"><a href="<?=$l?>"><?=$m['flags']?></a></td>
					<td onclick="<?=$l2?>" class="subject"><a href="<?=$l?>"><?=$m['subject']?></a></td>
					<td onclick="<?=$l2?>" class="from"><a href="<?=$l?>">[<?=$m['from']?>]</a></td>
					<td onclick="<?=$l2?>" class="date"><a href="<?=$l?>">[<?=$m['date']?>]</a></td>
				</tr>
			<?}?>
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: foreach pagination

Post by social_experiment »

“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply