[Lift] Re: Friendly url parameter for PaginateSnippet?

2009-10-26 Thread Naftoli Gugenheim

I was just thinking about your question. If you want Paginator to generate 
links with query parameters indeed it's not straightforward. But if you want to 
optionally allow users to specify the page in the URL, add code like the 
following in a (possibly anonymous) subclass of Paginator (example sets number 
per page):
override def paginate(ns: NodeSeq) = {
  S.param(num).foreach(num = _)
  super.paginate(ns)
}

-
night_stalkerusur...@gmail.com wrote:


Hi all, I've just tried the PaginatedSnippet and is willing to make
some query pages with it, but the url parameter looks not very good (I
got a /post?F1054255562605UD5=_ ).

So —— how to make paginated page's url more friendly? I'd prefer
something like /posts?page=2.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Friendly url parameter for PaginateSnippet?

2009-10-18 Thread Marius

F1054255562605UD5 means that a function on server side will be invoked
when this is sent. I believe these is a function that the Paginator is
binding automatically. Is there a more specific reason why you want
this ?

Br's,
Marius

On Oct 18, 11:12 am, night_stalker usur...@gmail.com wrote:
 Hi all, I've just tried the PaginatedSnippet and is willing to make
 some query pages with it, but the url parameter looks not very good (I
 got a /post?F1054255562605UD5=_ ).

 So —— how to make paginated page's url more friendly? I'd prefer
 something like /posts?page=2.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Friendly url parameter for PaginateSnippet?

2009-10-18 Thread night_stalker

Thank you for your explanation.

The reason is users don't get the same page with the same url,
 and, they can't read the url.
Just wondering if I can use existing classes or should write my own.
It seems I shouldn't use stateful snippet for this, stateless
requirement.

Best regards.

On Oct 18, 6:35 pm, Marius marius.dan...@gmail.com wrote:
 F1054255562605UD5 means that a function on server side will be invoked
 when this is sent. I believe these is a function that the Paginator is
 binding automatically. Is there a more specific reason why you want
 this ?

 Br's,
 Marius

 On Oct 18, 11:12 am, night_stalker usur...@gmail.com wrote:

  Hi all, I've just tried the PaginatedSnippet and is willing to make
  some query pages with it, but the url parameter looks not very good (I
  got a /post?F1054255562605UD5=_ ).

  So —— how to make paginated page's url more friendly? I'd prefer
  something like /posts?page=2.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Friendly url parameter for PaginateSnippet?

2009-10-18 Thread Naftoli Gugenheim
Two points.

   1. Could you explain in more detail the advantage of a friendly URL?
   2. Keep in mind that it's safer for MVC frameworks to implement such a
   scheme, because you only use pagination on a page which is designed with
   pagination in mind. In Lift, with View First, pagination could coexist
   alongside another snippet that uses the 'page' query parameter. Technically
   you could have to PaginatedSnippets side by side on the same page. So how
   would you solve the problem of them keeping their information to themselves?


On Sun, Oct 18, 2009 at 9:09 AM, Marius marius.dan...@gmail.com wrote:


 There are very few things truly stateless in lift such as
 LiftRules.statelessDispatchTable. Once you bind functions Lift creates
 a name for these functions. These names are quite opaque (I think Dave
 wanted to add a mechanism to allow users to specify their own
 naming ...). For each page rendering these names are generated so if
 you just refresh a page this names will change. This is important for
 security reasons.

 If you don't like this mechanism you could easily write your own
 pagination using your own URL's and query string params.

 Br's,
 Marius

 On Oct 18, 3:54 pm, night_stalker usur...@gmail.com wrote:
  Thank you for your explanation.
 
  The reason is users don't get the same page with the same url,
   and, they can't read the url.
  Just wondering if I can use existing classes or should write my own.
  It seems I shouldn't use stateful snippet for this, stateless
  requirement.
 
  Best regards.
 
  On Oct 18, 6:35 pm, Marius marius.dan...@gmail.com wrote:
 
   F1054255562605UD5 means that a function on server side will be invoked
   when this is sent. I believe these is a function that the Paginator is
   binding automatically. Is there a more specific reason why you want
   this ?
 
   Br's,
   Marius
 
   On Oct 18, 11:12 am, night_stalker usur...@gmail.com wrote:
 
Hi all, I've just tried the PaginatedSnippet and is willing to make
some query pages with it, but the url parameter looks not very good
 (I
got a /post?F1054255562605UD5=_ ).
 
So —— how to make paginated page's url more friendly? I'd prefer
something like /posts?page=2.
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---