logo
WSN Links PHP Directory Software
Features Showcase Reviews Demos Purchase Manual Support
 

How to use pagination in admin panel.

Version: WSN Links 4.1.39


How to use pagination in admin panel.
ngprasad
Beginner

Usergroup: Customer
Joined: Apr 28, 2008
Total Topics: 3
Total Posts: 6
Posted 04/28/08 - 01:54 AM:
quote post
#1
Hi All,

I have created new page in admin panel.But pagination is not working.

In php file, i am using this code

if (!$page) $page = 1;
if (!$perpage) $perpage = 25;
$start = ($perpage * $page) - $perpage;

$q = $db->select('id,ip,date', 'permanentblacklisttable',"id != ''",'ORDER BY id DESC',"LIMIT $start,$perpage");
$n = $db->numrows($q);

$template->paginate($page, $perpage, $possible);

In Tpl file, i am using this code

{PAGINATION}

But pagination is not working.Can you please help me anyone.
Paul
Administrator
Avatar

Usergroup: Administrator
Joined: Dec 21, 2001
Location: Northern California
Total Topics: 49
Total Posts: 5539
Posted 04/28/08 - 09:45 PM:
quote post
#2
How exactly did you create a new page -- do you just mean a custom template -- and what exactly are you doing with PHP? What's the full content of the PHP file you're typing?
ngprasad
Beginner

Usergroup: Customer
Joined: Apr 28, 2008
Total Topics: 3
Total Posts: 6
Posted 04/29/08 - 10:29 AM:
quote post
#3
Hi Paul,

I have created new table in wsnlinks database called permanentblacklisttable.In that i am inserting ipaddress.

I have created two files in

admin/permanent.php

<?php
require 'adminstart.php';

if (!$page) $page = 1;
if (!$perpage) $perpage = 50;
$start = ($perpage * $page) - $perpage;

$template = new template('admin/permanent.tpl');
//select
$q = $db->select('id,ip,date', 'permanentblacklisttable',"id != ''",'ORDER BY id DESC',"LIMIT $start,$perpage");
$n = $db->numrows($q);
$bit = $template->extract('<!-- BEGIN ROW -->', '<!-- END ROW -->');
for ($x=0; $x<$n; $x++)
{
$r = $db->row($q);
$id = $r[0]; $ip = $r[1];
$thisbit = $bit;
$thisbit = str_replace('{ID}', $id, $thisbit);
$thisbit = str_replace('{IP}', $ip, $thisbit);
$all .= $thisbit;
}
$template->replace($bit, $all);
$template->paginate($page, $perpage, $possible);

require 'adminend.php';
?>

And template file in

templates/admin/permanent.tpl

<div class="title">Permanent Black List</div>
<table border="1" align="center" cellspacing="1" cellpadding="3" width="300">
<tr>
<td align="center" width="30"><b>ID</b></td> ;
<td align="center" width="30"><b>IP</b></td> ;
<td align="center" width="40"><b>Action</b></td >
</tr>
<IF {SCRIPTNAME} is add>
<form action="http://www.webmastersite.net/forums/permanent.php" method="post">
<tr>
<td align="center" colspan="3"><input type="text" value="" name="ip" size="25">    <input type="submit" value="Add" name="action"> </td>
</tr>
</form>
</IF>
<IF {SCRIPTNAME} is update>
<form action="http://www.webmastersite.net/forums/permanent.php" method="post">
<input type="hidden" value="{ID1} " name="id">
<tr>
<td align="center" colspan="3"><input type="text" value="{IP1} " name="ip" size="25">    <input type="submit" value="Update" name="action"> </td>
</tr>
</form>
</IF>
<!-- BEGIN ROW -->
<tr>
<td align="center">{ID}</td>
<td align="center">{IP}</td>
<td align="center"><a href="permanent.php?action=edit&id={ID}" ; style="text-decoration: none;color: #666666;">Edit    <a href="permanent.php?action=del&id={ID}" style="text-decoration: none;color: #666666;">Delete</a></td>
</tr>
<!-- END ROW -->
</table>
<form action="http://www.webmastersite.net/forums/permanent.php" method="post">
{PAGINATION}
</form>

But paging is not working.
Paul
Administrator
Avatar

Usergroup: Administrator
Joined: Dec 21, 2001
Location: Northern California
Total Topics: 49
Total Posts: 5539
Posted 04/30/08 - 01:41 AM:
quote post
#4
What exactly is the point of spending so many hours recreating functionality which already exists?

At any rate, {SCRIPTNAME} is never going to be "add" or "update" since it will always be wsnlinks in WSN Links. You seem to be typing things at random.
Search thread for
Download thread as


You don't have permission to post.

Please login or register.

Admin Control Panel

   
Home    |    Features    |    Showcase    |    Reviews    |    Demos    |    Purchase    |    Manual    |    Support
© 2008 Paul Knierim. All rights reserved.