Welcome, Guest
Username: Password: Remember me

TOPIC: Page Navigation

Page Navigation 27 Jun 2012 02:07 #2691

  • geoffr
  • geoffr's Avatar
  • Offline
  • Senior Member
  • Posts: 68
  • Thank you received: 2
  • Karma: 0
Is anyone able to provide some tips (or code?) for adding record navigation to the bottom of a component fly page?

We have a series of lessons, and want the user to click "Next" or "Previous" as required to progress through our course.

Help much appreciated!

Cheers,
Geoff
The administrator has disabled public write access.

Re: Page Navigation 07 Nov 2012 07:57 #5029

  • geoffr
  • geoffr's Avatar
  • Offline
  • Senior Member
  • Posts: 68
  • Thank you received: 2
  • Karma: 0
I'm now using Cook v2. Anyone?

thanks!
Geoff
The administrator has disabled public write access.

Re: Page Navigation 10 Nov 2012 22:50 #5238

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Not worked on that, but for sure is a very nice feature.

I would say you may have to use the userStates vars to STORE the current item, as INDEX of navigation
And, very important, you use another state var that is able to store the current filterred list of results.

I mean, if you only need to browse in a raw list, ok. But if you've just ended a search or a filtering, then you must keep this in memory. It is actually the case dy default.

With that, just write a SQL in the ITEM model that is calling the COLLECTION model, and querying the next result to deliver, basing on itself and on this collection model state vars.

Got it ?
Coding is now a piece of cake
The administrator has disabled public write access.

Re: Page Navigation 10 Nov 2012 22:55 #5241

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
I read again, and I think I am not clear ....

1. Your buttons Prev, Next are calling a function in the controller (ITEM).
2. Theses functions in controller (prev, next) are calling a COLLECTION model of the list and get the correct row as explained before.
3. At the end of the function, you set up a redirection calling the form, or fly of the requested item. You only have to specify the correct cid value contained in the URL for the redirection. You may understand the Cook redirector. Very nice feature that took me long to decide how to implement it well and easy to use.
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: JoomGuy

Re: Page Navigation 11 Nov 2012 03:48 #5250

  • geoffr
  • geoffr's Avatar
  • Offline
  • Senior Member
  • Posts: 68
  • Thank you received: 2
  • Karma: 0
Thanks very much for explaining this. It sounds a bit beyond me, but I will try to figure it out!

What is the Cook redirector? - Do you have any tutorials on how to use it?

thanks again!
Geoff
The administrator has disabled public write access.

Re: Page Navigation 11 Nov 2012 09:40 #5258

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Hi @geoffr

I'm sure you'll get there - just post any issues you find and we'll all try to help.

In layman's terms, say you're viewing an item in a particular category (just like in com_content), you get the list of items in that category from the collection (and it's order) - say this is an array(1, 2, 3, 4, 5) - then, working with the currently viewd id of 3, prev() function will step back to id 2 and the next() function will call id 4.

This is where the redirection comes in: taking the id from the next()/prev() functions, that needs to be passed into a url to get the item or form page depending on what you want to do.

RE: tutorials on redirection, @BTB300 has written quite extensively about custom redirects that may help you out. Don't be put off by the detail in there - it is quite deep - because, the type of redirection you require shouldn't be complex. Here's his article (V2.0 Cook): www.j-cook.pro/forum/33-developper-resso...-with-redirects#4149

Hope this helps,

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Page Navigation 11 Nov 2012 10:14 #5261

  • geoffr
  • geoffr's Avatar
  • Offline
  • Senior Member
  • Posts: 68
  • Thank you received: 2
  • Karma: 0
Fantastic Gez, thanks. I look forward to getting into this in a few days when I am back on the job!

Much appreciated,
Geoff
The administrator has disabled public write access.

Re: Page Navigation 11 Nov 2012 11:51 #5266

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
@audibleid.

About prev() and next(), I must say it is more complex.
For sure, both functions does the same in opposite directions, but it is not the incrementation of the id.

Your Next element can have an inferior id. It depends how it has been ordered, filterred, published, accessless, etc...
So this is why you must use the collection model, in order to implement all these filters and wizards.

The only thing to do is to create a custom sql profile, which will apply all the where and joins normally (list), but wich will return only ONE item : the NEXT or PREV.


So. Ready for it ?

When it is done, thanks to share ;-)

Just some clue :
For retreiving a neibourg element, you must base on :
- Ordering (if exists)
- Column current sorting (or search result sorting). This is when the user click to sort a column.
- The ordering, or sorting direction (ASC / DESC)
- Ordering default field (example : title)
- Id value (of course by default fallback)

Good program, and good sunday ...
Coding is now a piece of cake
The administrator has disabled public write access.

Re: Page Navigation 11 Nov 2012 13:51 #5274

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Hi Both,

@admin, thanks for the added tips and detail to your previous post!admin wrote:
About prev() and next(), I must say it is more complex.
For sure, both functions does the same in opposite directions, but it is not the incrementation of the id.
Sure, I know it's a little bit more complex than I stated although I did mention ordering. I just wanted to write the workflow in straight-forward terms to let @geoffr know the basics without really thinking about the code yet. Because he seem a bit concerned about it's complexity, I only gave a very simple example with the id's being retrieved in order (1, 2, 3, 4, 5) to demonstrate its most basic use.

Backed up with your how to, tips and code, I hope most users will be able to get their heads around it. ;)

Best wishes and let us know how you get on @geoffr !

Thanks

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Page Navigation 18 Mar 2013 04:20 #6972

  • geoffr
  • geoffr's Avatar
  • Offline
  • Senior Member
  • Posts: 68
  • Thank you received: 2
  • Karma: 0
I really appreciate the help above, understand the principle of what you are saying, but I'm not so advanced to be able to make sense of how to implement it.

- e.g., where to place the code, syntax, etc. I have used Cook because I'm not a programmer ;-), though I am happy to dabble as necessary. Most of my component is completed, it's really just the pagination I haven't yet worked out.

Is it possible to provide a working example of how to implement page navigation for a component?

thanks,
Geoff
The administrator has disabled public write access.

Re: Page Navigation 25 Mar 2013 00:41 #7009

  • geoffr
  • geoffr's Avatar
  • Offline
  • Senior Member
  • Posts: 68
  • Thank you received: 2
  • Karma: 0
Anyone?
The administrator has disabled public write access.

Re: Page Navigation 23 Apr 2013 03:03 #7067

  • geoffr
  • geoffr's Avatar
  • Offline
  • Senior Member
  • Posts: 68
  • Thank you received: 2
  • Karma: 0
Looking for a developer who can add the code for the navigation for my component made with J-Cook. If someone is able to provide navigation for one part of my component, I can use the code as a guide to do the rest.

Anyone able & interested? Will pay, of course.

regards,
Geoff
The administrator has disabled public write access.
Time to create page: 0.144 seconds

Get Started