Jump to content

More pagination...:)


unsider

Recommended Posts

1.

I also have a script that allows you to store comments into a database, and it then outputs those comments with date, text, etc...

 

2.

At the moment I have an array called ( $names ) full of ("hello").

Displayed functionality: http://rhythmicdesign.com/andy/index.php

 

 

I only currently have the pagination working for the array of words, I need the array to be functional with comments, so that if 32 comments are displayed it becomes 3.2 pages, you know it works.

 

It is 2 seperate components, but I would like to combine the two and display the comments, as opposed to an array string of text.

 

If that didn't make sense, make sure to question me :)

 

Everything is fully functional, I just need to turn the comments into something I can feed into the pagination so that it becomes one, I have trouble explaining it. :)

 

1.

  <?



echo '<table>';
$tr=1;
while ($row = mysql_fetch_array($result)) {
echo '<tr class="tr' . $tr . '"><td>' . $row["name"] . ' says: <br>' . $row['commentdate'] . '<br>' . $row['commenttext'] . '</td></tr>'; 

if($tr==1){
	$tr=2;
}
else if($tr==2){
	$tr=1;
}
}
echo '</table>';

echo '<br>';	

		echo '<a href="' . $_SERVER['PHP_SELF'] . '?addcomment=1">Add comment!</a>';

?>

 

 

2.

<?
$names = array("hello","hello","hello","hello","hello","hello","hello","hello","hello","hello","hello","hello");

$page = $_GET['page'];

$pagedResults = new Paginated($names, 10, $page);

echo "<ul>";

while($row = $pagedResults->fetchPagedRow()) {
	echo "<li>{$row}</li>";
}

echo "</ul>";

$pagedResults->setLayout(new DoubleBarLayout());
echo $pagedResults->fetchPagedNavigation();



?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.