# |
Mar 12th 2018, 15:58 |
neon1024 |
The paginator has an option of url, which will form the base of the url being built. So you can pass in your url with the params you need to include in the pagination. `$this->Paginator->options(['url' => ['controller' => 'Examples', 'action' => 'index', 'foo' => 'bar']])` |
# |
Mar 12th 2018, 15:58 |
learningcake |
raul338, not totally hide it if I can get it to work showing the id in the pagination. I just did a search method that makes use of GET and pagination works fine |
# |
Mar 12th 2018, 15:58 |
dereuromark |
the bottom line is: a filter as session is a usability killer. instead you should have good URLs by default. |
# |
Mar 12th 2018, 15:57 |
dereuromark |
dorxy: the post is not necessary if it doesnt come from a form - as a normal link it is fine as get. thats part of prg. |
# |
Mar 12th 2018, 15:57 |
neon1024 |
https://github.com/cakephp/cakephp/blob/master/src/View/Helper/PaginatorHelper.php#L53 |
# |
Mar 12th 2018, 15:56 |
learningcake |
@neon1024, can you explain more what you meant by pass the url into the helper |
# |
Mar 12th 2018, 15:56 |
raul338 |
i don't understand why learningcake want to hide the store id in the pagination |
# |
Mar 12th 2018, 15:56 |
neon1024 |
It prevents resubmission |
# |
Mar 12th 2018, 15:55 |
learningcake |
was thinking session |
# |
Mar 12th 2018, 15:55 |
dorxy |
why post pagination? |
# |
Mar 12th 2018, 15:55 |
dorxy |
although I don't completely understand how that would be applicable here |
# |
Mar 12th 2018, 15:55 |
learningcake |
hmm. thank you Geniuses |
# |
Mar 12th 2018, 15:55 |
dorxy |
TIL :slightly_smiling_face: thanks |
# |
Mar 12th 2018, 15:54 |
neon1024 |
Totally agree! |
# |
Mar 12th 2018, 15:54 |
dereuromark |
neon1024: the idea is the same, you can just use that and do it on your own using that idea, but session is never the right solution here :slightly_smiling_face: |
# |
Mar 12th 2018, 15:54 |
neon1024 |
Post Redirect Get, https://en.wikipedia.org/wiki/Post/Redirect/Get |
# |
Mar 12th 2018, 15:53 |
dereuromark |
dorxy: https://github.com/FriendsOfCake/search#component |
# |
Mar 12th 2018, 15:53 |
neon1024 |
Well, although I agree, it’s a bit heavy for what’s needed. Personally I would pass the url into the helper |
# |
Mar 12th 2018, 15:53 |
dorxy |
@dereuromark what is prg? |
# |
Mar 12th 2018, 15:53 |
learningcake |
okay |
# |
Mar 12th 2018, 15:53 |
dereuromark |
I just told you: query string, prg, search plugin |
# |
Mar 12th 2018, 15:52 |
learningcake |
please, how do I do it the right way, |
# |
Mar 12th 2018, 15:52 |
dereuromark |
do it the right way, hacking it here only brings in bugs and usability issues |
# |
Mar 12th 2018, 15:52 |
dereuromark |
he should look into prg pattern and foc/search plugin instead |
# |
Mar 12th 2018, 15:52 |
learningcake |
yes |
# |
Mar 12th 2018, 15:52 |
raul338 |
in that case the pagination helper should keep the id |
# |
Mar 12th 2018, 15:51 |
raul338 |
I think learningcake is trying to make a pagination inside a view, like /stores/63?page=2 |
# |
Mar 12th 2018, 15:51 |
dorxy |
is the reason you're writing it to the session because it is not persisted between pagination? or because you wish to access it for other requests as well? |
# |
Mar 12th 2018, 15:51 |
neon1024 |
Then might I recommend using a url friend slug of the username? |
# |
Mar 12th 2018, 15:51 |
learningcake |
@neon, it is meant to be a public data. thank you |
# |
Mar 12th 2018, 15:50 |
dereuromark |
I recommend using query strings instead as we probably all do :slightly_smiling_face: |
# |
Mar 12th 2018, 15:50 |
neon1024 |
Well if you’re using incremental id’s and you are not checking the id, I could just change it to 64 and see another users data |
# |
Mar 12th 2018, 15:50 |
dereuromark |
using the session for pagination stuff is usually a huge anti pattern and usability killer |
# |
Mar 12th 2018, 15:50 |
dorxy |
I'm still wondering how/why exactly you're doing it this way |
# |
Mar 12th 2018, 15:50 |
learningcake |
@neon, the id is exposed to the url. Any security risk? |
# |
Mar 12th 2018, 15:50 |
dorxy |
perhaps you should put an if statement around your write function to determine if there even is an ID parameter? |
# |
Mar 12th 2018, 15:49 |
neon1024 |
You can change the pagination url in the helper options |
# |
Mar 12th 2018, 15:49 |
learningcake |
no, the id is not persisted between pagination requests. Don't know how to make it persistent since the url is meant to be a unique link http://localhost:8765/mystore/63 |
# |
Mar 12th 2018, 15:49 |
neon1024 |
I hope the user id isn’t exposed to the url |
# |
Mar 12th 2018, 15:48 |
dorxy |
if you execute `$this->request->session()->write('User.id',$this->request->getParam('id'));` again on the next page, and maybe the ID param is not present in the URI at that point? |
# |
Mar 12th 2018, 15:47 |
dorxy |
is the id parameter persisted between the pagination requests? |