From 027463a9100ea76bba6369b78bdcc4206710dbb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dario=20B=C3=B6sch?= Date: Fri, 22 May 2015 12:02:33 +0200 Subject: [PATCH] #3: added pagination links at bottom of the blog page --- .../demo/modules/blog/handler/blog_handler.e | 43 +++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/examples/demo/modules/blog/handler/blog_handler.e b/examples/demo/modules/blog/handler/blog_handler.e index c5ec75d..bfec0e7 100644 --- a/examples/demo/modules/blog/handler/blog_handler.e +++ b/examples/demo/modules/blog/handler/blog_handler.e @@ -66,7 +66,7 @@ feature -- HTTP Methods n: CMS_NODE lnk: CMS_LOCAL_LINK hdate: HTTP_DATE - page_number:NATURAL_16 + page_number, tmp:NATURAL_16 do -- At the moment the template is hardcoded, but we can -- get them from the configuration file and load them into @@ -81,7 +81,7 @@ feature -- HTTP Methods page_number := page_number_path_parameter (req) end - -- Ensure that page is never 0 (happens if /blogs/ is routed) + -- Ensure that page is never 0 (happens if /blogs/ is routed and then "" interpreted as 0) if page_number = 0 then page_number := 1 end create {GENERIC_VIEW_CMS_RESPONSE} l_page.make (req, res, api) @@ -96,10 +96,10 @@ feature -- HTTP Methods end s.append ("") - + -- Get the posts from the current page (given by page number and entries per page) if attached node_api.blogs_order_created_desc_limited (entries_per_page, (page_number-1) * entries_per_page) as lst then - -- Filter out blog entries from all nodes - --if n.content_type.is_equal ("blog") then + + -- List all posts of the blog s.append ("%N") - -- Show the pagination if there are more than one page - if more_than_one_page then - s.append ("