Using phpbbs generate_pagination

Discussion of general topics related to the new version and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Forum rules
Discussion of general topics related to the new release and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Post Reply
Joablen
Posts: 60
Joined: Sun Aug 27, 2006 3:09 am
Contact:

Using phpbbs generate_pagination

Post by Joablen »

hi!
i would like to know if anyone here knows how to use the new way that phpbb uses for the generate_pagination and if you could give me an example... cause i noticed that its done differently from phpbb2

agent00shoe

Re: Using phpbbs generate_pagination

Post by agent00shoe »

Did you see it in functions.php?

Code: Select all

function generate_pagination($base_url, $num_items, $per_page, $start_item, $add_prevnext_text = false, $tpl_prefix = '')
and a sample from viewtopic.php

Code: Select all

$pagination = generate_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&$u_sort_param" . (($highlight_match) ? "&hilit=$highlight" : '')), $total_posts, $config['posts_per_page'], $start);

User avatar
Dog Cow
Registered User
Posts: 271
Joined: Wed May 25, 2005 2:14 pm

Re: Using phpbbs generate_pagination

Post by Dog Cow »

I don't think it's changed much at all.

Joablen
Posts: 60
Joined: Sun Aug 27, 2006 3:09 am
Contact:

Re: Using phpbbs generate_pagination

Post by Joablen »

sorry if i didn't explain well want i wanted... i didn't mean the function, i meant the whole thing, the sql query and all that... but i already found it, i just didn't wanna go over the code :P

to use it you would have to make your query then use $db->sql_query_limit and then the generate pagination is just for the links...

angelside
Registered User
Posts: 4
Joined: Sat Jan 27, 2007 11:27 am

Re: Using phpbbs generate_pagination

Post by angelside »

Why not work this code?

code:

Code: Select all

	'PAGINATION'	=> generate_pagination(append_sid("{$phpbb_root_path}test.$phpEx"), $total_bans, $config['test_per_page'], $start),
output:

Code: Select all

test.php&start=2
where "?" ? I don't have any other parameter.


everything is OK. I write manual of test $config['test_per_page'] = 2;

append_sid is not have 2. parameter. if I write 2. parameter is work, but my page don't have any other parameter.


Work: (output: test.php?u=2&start=2)
'PAGINATION' => generate_pagination(append_sid("{$phpbb_root_path}test.$phpEx", "u=2"), $total_tests, $config['test_per_page'], $start),


Not work: (output: test.php&start=2) not have ?
'PAGINATION' => generate_pagination(append_sid("{$phpbb_root_path}test.$phpEx"), $total_tests, $config['test_per_page'], $start),


Referance:

Code: Select all

/**
* Append session id to url
*
* @param string $url The url the session id needs to be appended to (can have params)
* @param mixed $params String or array of additional url parameters
* @param bool $is_amp Is url using & (true) or & (false)
* @param string $session_id Possibility to use a custom session id instead of the global one
*
* Examples:
* <code>
* append_sid("{$phpbb_root_path}viewtopic.$phpEx?t=1&f=2");
* append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=1&f=2');
* append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=1&f=2', false);
* append_sid("{$phpbb_root_path}viewtopic.$phpEx", array('t' => 1, 'f' => 2));
* </code>
*/

Code: Select all

function generate_pagination($base_url, $num_items, $per_page, $start_item, $add_prevnext_text = false, $tpl_prefix = '')

phpBB3 Portal | simple portal for phpBB3 Olympus
phpBB3 Project | phpBB3 mods, add-ons, themes, graphics
phpBB Türkiye | Turkish phpBB community

angelside
Registered User
Posts: 4
Joined: Sat Jan 27, 2007 11:27 am

Re: Using phpbbs generate_pagination

Post by angelside »

anything for me ?

phpBB3 Portal | simple portal for phpBB3 Olympus
phpBB3 Project | phpBB3 mods, add-ons, themes, graphics
phpBB Türkiye | Turkish phpBB community

Rizzn.
Registered User
Posts: 2
Joined: Thu Jan 25, 2007 6:45 am

Re: Using phpbbs generate_pagination

Post by Rizzn. »

Try changing test.php&start=2 to test.php?start=2

User avatar
Handyman
Registered User
Posts: 522
Joined: Thu Feb 03, 2005 5:09 am
Location: Where no man has gone before!
Contact:

Re: Using phpbbs generate_pagination

Post by Handyman »

Rizzn. wrote: Try changing test.php&start=2 to test.php?start=2

The test.php&start=2 is the output.
It's in the code somewhere, but I don't see it either… it looks like it's supposed to.
The append_sid should automatically decide where to put the question mark... so I've looked at that a few times and I still don't get it.
If it were me, I would rewrite something very simple that works, then gradually add stuff to it until you have what you need or it doesn't work… then you should be able to find what needs to be fixed.
My phpBB3 Mods || My Mod Queue
Search Engine Friendly (SEO) URLs || Profile link on Avatar and/or Username || AJAX Chat
Display Posts Anywhere || CashMod || AJAX Quick Edit || AJAX Quick Reply

Image

User avatar
Acyd Burn
Posts: 1838
Joined: Tue Oct 08, 2002 5:18 pm
Location: Behind You
Contact:

Re: Using phpbbs generate_pagination

Post by Acyd Burn »

If you do not append variables, you *must* add a question mark.

Image

Post Reply