View previous topic :: View next topic |
Author |
Message |
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Oct 06, 2005 8:43 pm Post subject: SmartyPaginate 1.5 Released |
|
|
Changes since 1.4:
* fix bug with last link on uneven groupings (pt2002, monte)
* fix error in paginate_middle with replacing & (Michele, monte)
* add setPageLimit()/getPageLimit() functions (monte)
* make error messages better in plugins (monte)
* fix format=page error in paginate_middle href tags (NeXXt, monte)
http://www.phpinsider.com/php/code/SmartyPaginate/ |
|
Back to top |
|
talo Smarty Rookie
Joined: 18 Oct 2005 Posts: 16
|
Posted: Tue Nov 15, 2005 9:28 am Post subject: Download in .Zip??? |
|
|
Hi,
I was wandering if there is a Zipped form of the the plugin to download?
I get the following error: "error reading header after processing 0 entries"
trying to open it with WinZip.
Tnx,
T. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Nov 15, 2005 10:01 pm Post subject: |
|
|
WinZip should have no problem opening .tar.gz files?
No, there is no .zip version of it. Maybe someone can untar this and zip it for you. |
|
Back to top |
|
Boby Smarty Rookie
![](images/avatars/gallery/Face_3D/iconufo.gif)
Joined: 21 Jan 2006 Posts: 21
|
Posted: Sat Apr 01, 2006 10:26 am Post subject: |
|
|
Just a question
in function.paginate_middle.php you have this:
Code: | if($params['format'] == 'page') {
$_text = $_prefix . $_page . $_suffix;
} else {
$_text = $_prefix . $_item . '-';
$_text .= ($_item + $_limit - 1 <= $_total) ? $_item + $_limit - 1 : $_total;
$_text .= $_suffix;
} |
Shouldn't be there a way to have this style of links?
1 2 3 [4] 5 6 7
or
1-10 11-20 21-30 31-40 [41-50] 51-60 61-70
Where in this case [4] or [41-50] is the current page. Most homepages are using this style. Probably add two more parameters like $_current_prefix and $_current_suffix.
Thank you!
Boby _________________ My Homepage: www.frozenminds.com |
|
Back to top |
|
TGKnIght Smarty Junkie
![](images/avatars/gallery/Avatar_Pack_1/523.gif)
Joined: 07 Sep 2005 Posts: 580 Location: Philadelphia, PA
|
|
Back to top |
|
Elandril Smarty n00b
Joined: 18 Apr 2006 Posts: 2
|
Posted: Tue Apr 18, 2006 9:54 am Post subject: |
|
|
Firstly thanks for this awesome pluging...
and secondly I've got a little feature request!
I really like this plugin and have already used it in a number of pages, but now I've got to revamp a few of them using AJAX. So I'd like to remain using this add-on, but it would have to be changed.
I don't know if something like this has already been proposed, but could the add-on be extended to not only produce links with href and get variables, but alternatively links with href="#" and onclick="ajaxproc(pagenumber); return false;" ? |
|
Back to top |
|
cdukes Smarty n00b
Joined: 15 May 2006 Posts: 2
|
Posted: Tue May 16, 2006 2:07 pm Post subject: Paginate 1.5 Problem |
|
|
I'm trying to get this working but am having trouble.
Here's my code:
Code: |
function get_db_results() {
$_query = sprintf(
"SELECT SQL_CALC_FOUND_ROWS * FROM " . DBD_TABLE . " LIMIT %d,%d",
SmartyPaginate::getCurrentIndex(), SmartyPaginate::getLimit()
);
$_result = mysql_query($_query) || die (mysql_error("Result: $_result " . mysql_error()));
while ($_row = mysql_fetch_array($_result, MYSQL_ASSOC)|| die ("Query: $_query <br>Result: $_result "
. mysql_error())) {
// collect each record into $_data
$_data[] = $_row;
}
// now we get the total number of records from the table
$_query = "SELECT FOUND_ROWS()";
$_result = mysql_query($_query) || die ("Query: $_query " . mysql_error());
$_row = mysql_fetch_array($_result, MYSQL_ASSOC) || die ("Result: $_result " . mysql_error());
SmartyPaginate::setTotal($_row['FOUND_ROWS']);
return $_data;
}
|
Here's the result I get:
Code: |
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /www/cmdb/html/libs/dbd.lib.php on line 171
Query: SELECT SQL_CALC_FOUND_ROWS * FROM ciscoworks LIMIT 0,25
Result: 1
|
Why is there only 1 result?
If I run it manually in mysql, it works fine.
Code: |
mysql> SELECT SQL_CALC_FOUND_ROWS * FROM ciscoworks LIMIT 0,25;
...snip
25 rows in set (0.01 sec)
|
|
|
Back to top |
|
mapletip Smarty n00b
Joined: 22 Oct 2006 Posts: 2
|
Posted: Sun Oct 22, 2006 7:20 am Post subject: |
|
|
I don't know if anyone cares but there's an XSS attack in the next variable.
To fix..
Find:
Code: |
function getCurrentItem($id = 'default') {
|
Change the body of the function to..
Code: | if (is_numeric($id)) {
return htmlentities($_SESSION['SmartyPaginate'][$id]['current_item']);
}else{
//they be tryin' to hack us lawl
$id = 'default';
return htmlentities($_SESSION['SmartyPaginate'][$id]['current_item']);
} |
And that's it [/code] |
|
Back to top |
|
conrad10781 Smarty n00b
Joined: 24 Jun 2006 Posts: 4
|
Posted: Sun Apr 15, 2007 5:54 pm Post subject: |
|
|
Not sure if I am the only one who is experiencing this, but here is a fix who are. I had some issues where we would be using pagination on one link ( page1.php ), people would then follow another link to another part of our site ( page2.php ), upon going back to page1.php the last page they were on, they are brought to the last page of the pagination they were on.. IE page 6 say, instead of being refreshed back to page 1. If anyone else comes across this, here is what we did
in SmartyPaginate.class.php ( starting ~ 223 ), You can obviously adjust ['next'] to whatever you use , or there may even be a class object you can use to make it universal
More or less just replace the 2 functions ( getCurrentItem & getCurrentIndex )
Code: |
function getCurrentItem($id = 'default') {
/**
* fix by RCS
* initial page landing would show page 3 if that is where they were last
*/
if(!isset($_GET['next'])){
return "1";
}else{
return $_SESSION['SmartyPaginate'][$id]['current_item'];
}
}
/**
* get the current item index
*
* @param string $id the pagination id
*/
function getCurrentIndex($id = 'default') {
/**
* fix by RCS
* initial page landing would show page 3 if that is where they were last
*/
if(!isset($_GET['next'])){
return "0";
}else{
return $_SESSION['SmartyPaginate'][$id]['current_item'] - 1;
}
}
|
NOTE: This was my fault, there was nothing wrong with the smarty code, the code I was using around my reset call, which was caused by a new mod_rewrite rule |
|
Back to top |
|
|