Passing $GET Urls in pagination

Discussion and education for beginner / novice programmers interested in embarking on the development process to take advantage of the extensible nature of the Joomla! CMS.
Locked
User avatar
researchtoxic
Joomla! Ace
Joomla! Ace
Posts: 1023
Joined: Fri Mar 03, 2006 3:52 pm
Location: Macon, GA
Contact:

Passing $GET Urls in pagination

Post by researchtoxic » Mon Jul 14, 2008 5:03 pm

http://docs.joomla.org/Using_JPaginatio ... _component

Follwing the above

I need to figure out to pass a string of GET vars with the paginatin links

my users need it for bookmarking etc
http://www.netentropy.com - Drupal, Joomla and whatever performance.

secteur
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 146
Joined: Tue Nov 08, 2005 9:32 am
Location: Malaysia

Re: Passing $GET Urls in pagination

Post by secteur » Tue Jul 15, 2008 4:46 pm

Hi again,

sorry for getting your problem wrong the first time.

But I think this should be what you're looking for:

The pagination (front-end) links are handled by JRoute. Which in turn calls to JRouter.

So, in your view, if you add the following code:

Code: Select all

$app    =& JFactory::getApplication();
$router =& $app->getRouter();
$router->setVar( 'key', 'value' );
before calling the JPagination, all the links should be modified.

I've tested on a JPagination which had the following link (picked one randomly, all the others behaved the same):

Code: Select all

http://localhost/Joomla153/index.php?option=com_content&view=category&id=31&Itemid=53&limitstart=15
and all links became:

Code: Select all

http://localhost/Joomla153/index.php?option=com_content&view=category&id=31&Itemid=53&key=value&limitstart=15
etc...

There is even a $router->setVars method which should add as many variables as you want hence enabling you to keep the pagination state.

Hope that's what you needed.

User avatar
researchtoxic
Joomla! Ace
Joomla! Ace
Posts: 1023
Joined: Fri Mar 03, 2006 3:52 pm
Location: Macon, GA
Contact:

Re: Passing $GET Urls in pagination

Post by researchtoxic » Tue Jul 15, 2008 5:27 pm

this seems to be about what i am looking for

i am just unsure where in the code to implement it

this just goes somwhere in the code above where you use the pagination funcitons?

Can't wait to try this out!

I'll keep you post (and everyone else on how this is going)
http://www.netentropy.com - Drupal, Joomla and whatever performance.

secteur
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 146
Joined: Tue Nov 08, 2005 9:32 am
Location: Malaysia

Re: Passing $GET Urls in pagination

Post by secteur » Wed Jul 16, 2008 1:02 am

At first I thought you'd have to put the code from my first post before instantiating the JPagination object in the view.html.php of your component.
But if you print_r the JPagination object after it's been instantiated, it only has pure pagination parameters (limit, start, total,...) no link.

So the links are created only when you call the getListFooter or similar. Means that anywhere before the getListFooter call should have the expected effect.

Yup, keep us posted please.

User avatar
researchtoxic
Joomla! Ace
Joomla! Ace
Posts: 1023
Joined: Fri Mar 03, 2006 3:52 pm
Location: Macon, GA
Contact:

Re: Passing $GET Urls in pagination

Post by researchtoxic » Wed Jul 16, 2008 2:01 am

I will def write a tutorial on this once i figure it out

do you know if i need to call one of the globals like mainframe

i am never quite sure when i need to do that
http://www.netentropy.com - Drupal, Joomla and whatever performance.

User avatar
researchtoxic
Joomla! Ace
Joomla! Ace
Posts: 1023
Joined: Fri Mar 03, 2006 3:52 pm
Location: Macon, GA
Contact:

Re: Passing $GET Urls in pagination

Post by researchtoxic » Thu Jul 17, 2008 4:06 pm

I am happy to report (which i am sure you all knew)

that the pagination class maintains the GET state without any additional coding

you can see my example at

http://www.bostondiamondexchange.com/be ... pagination
http://www.netentropy.com - Drupal, Joomla and whatever performance.

Gergo Erdosi
Joomla! Virtuoso
Joomla! Virtuoso
Posts: 4031
Joined: Sat Nov 11, 2006 9:34 pm
Location: Hungary

Re: Passing $GET Urls in pagination

Post by Gergo Erdosi » Thu Jul 17, 2008 4:19 pm

This happens with me many times... I spend hours or days with a problem and finally found the solution, which is only one line... :)

User avatar
subfighter
Joomla! Intern
Joomla! Intern
Posts: 60
Joined: Wed Feb 07, 2007 7:26 pm
Location: Oceanside
Contact:

Re: Passing $GET Urls in pagination

Post by subfighter » Sat Jul 26, 2008 6:02 pm

can you post the instructions on how you get this working.. i been reading here and the documentation and finding it hard as i am not a php programmer... i can get stuff done with php but more cut and past and changing some variables :)

the thing is i am using the Seyret Video component and i got like 800 videos.. and there are to many pages being listed at the bottom as there is some pagination but what i want is to list like everything else.. something simliar to the bottom where it has the set limit on how many page to display and how many items per page.

1,2,3,......100,101

i am on joomla 1.5x so the documentation is getting confusing to me because i find the 1.0x and the 1.5x examples i am getting lost on what i need to add..

any help appreciated
Rick Estrada
http://www.jomtube.com - Video Gallery Component
http://www.subfighter.tv - Mixed Martial Arts Social Network


Locked

Return to “Joomla! Coding 101”