add('TITLE', 'Manage Flagged Quotes'); $template->add('FLAGGED', 'flagged=&'); $getposts = "SELECT * FROM rash_quotes WHERE flag = 1 ORDER BY id DESC"; } else { $template->add('TITLE', 'Manage Quotes'); $template->add('FLAGGED', ''); $getposts = "SELECT * FROM rash_quotes ORDER BY id DESC"; } $getposts2 = mysql_query($getposts); $i=0; while ($getposts3[$i] = mysql_fetch_array($getposts2)) { $i++; } if ($i != 0) { $template->adds_block('AVAIL',array('exi'=>1)); } else { $template->adds_block('NOTAVAIL',array('exi'=>1)); } $pager = &Pager::factory(array( 'mode' => 'Sliding', 'perPage' => 20, 'delta' => 2, 'itemData' => $getposts3)); $j=0; foreach ($pager->getPageData() as $post) { if (!empty($post)) { $template->adds_block('QUOTE', array( 'EXCERPT' => htmlspecialchars(strpos($post['quote'],"\n") !== FALSE ? substr($post['quote'],0,strpos($post['quote'],"\n")) : $post['quote']), 'ID' => $post['id'], 'ODD' => ($j % 2 ? '' : ' class="odd"'))); } $j++; } $template->add('PAGEID', $pager->getCurrentPageID()); $template->add('PAGINATION', $pager->links); $template->display(); ?>