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?
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.
0/5
1
2
3
4
5
Sorry, you don't have permission to post posts. Log in, or register if you haven't yet.
Comments on How to use pagination in admin panel.
Member
Usergroup: Customer
Joined: Apr 28, 2008
Total Topics: 5
Total Comments: 21
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.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
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?
Member
Usergroup: Customer
Joined: Apr 28, 2008
Total Topics: 5
Total Comments: 21
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="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="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="permanent.php" method="post">
{PAGINATION}
</form>
But paging is not working.
developer
Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California
Total Topics: 61
Total Comments: 7868
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.