Hi. Instead of using the standard pagination I want to have two buttons, one next, and one previous.
Is it possible to code a next and previous button for pages? if so how?
Many Thanks
Chris
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
August 31, 2011 5:26am
Subscribe [3]#1 / Aug 31, 2011 5:26am
Hi. Instead of using the standard pagination I want to have two buttons, one next, and one previous.
Is it possible to code a next and previous button for pages? if so how?
Many Thanks
Chris
#2 / Aug 31, 2011 5:38am
Yep you can do this easily - check out the docs here - http://ellislab.com/expressionengine/user-guide/modules/channel/entry_linking.html
#3 / Aug 31, 2011 5:40am
Thanks for the reply. I am using this for my next and previous articles on the view page.
How would I use this to go to the next and previous pages the same as pagination does?
Thanks
#4 / Aug 31, 2011 5:44am
Yep did you try the link I sent above? That does what you’re asking
If you mean to go to the next/previous page of results, the docs are here http://ellislab.com/expressionengine/user-guide/modules/channel/pagination_page.html
#5 / Aug 31, 2011 5:46am
Fantastic the second link was what I was looking for.
Thankyou very much! Have a great day!
#6 / Aug 31, 2011 5:49am
No problem, glad you got it sorted!
#7 / Aug 31, 2011 6:01am
Okay I jumped the gun a bit here I think!
I am getting this error:
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY `comment_date` asc' at line 7
SELECT `exp_comments`.`comment_id`, `exp_comments`.`entry_id`, `exp_comments`.`channel_id`, `exp_comments`.`author_id`, `exp_comments`.`name`, `exp_comments`.`email`, `exp_comments`.`url`, `exp_comments`.`location` AS c_location, `exp_comments`.`ip_address`, `exp_comments`.`comment_date`, `exp_comments`.`edit_date`, `exp_comments`.`comment`, `exp_comments`.`site_id` AS comment_site_id, `exp_members`.`username`, `exp_members`.`group_id`, `exp_members`.`location`, `exp_members`.`occupation`, `exp_members`.`interests`, `exp_members`.`aol_im`, `exp_members`.`yahoo_im`, `exp_members`.`msn_im`, `exp_members`.`icq`, `exp_members`.`group_id`, `exp_members`.`member_id`, `exp_members`.`signature`, `exp_members`.`sig_img_filename`, `exp_members`.`sig_img_width`, `exp_members`.`sig_img_height`, `exp_members`.`avatar_filename`, `exp_members`.`avatar_width`, `exp_members`.`avatar_height`, `exp_members`.`photo_filename`, `exp_members`.`photo_width`, `exp_members`.`photo_height`, `exp_member_data`.*, `exp_channel_titles`.`title`, `exp_channel_titles`.`url_title`, `exp_channel_titles`.`author_id` AS entry_author_id, `exp_channels`.`comment_text_formatting`, `exp_channels`.`comment_html_formatting`, `exp_channels`.`comment_allow_img_urls`, `exp_channels`.`comment_auto_link_urls`, `exp_channels`.`channel_url`, `exp_channels`.`comment_url`, `exp_channels`.`channel_title` FROM (`exp_comments`) LEFT JOIN `exp_channels` ON `exp_comments`.`channel_id` = `exp_channels`.`channel_id` LEFT JOIN `exp_channel_titles` ON `exp_comments`.`entry_id` = `exp_channel_titles`.`entry_id` LEFT JOIN `exp_members` ON `exp_members`.`member_id` = `exp_comments`.`author_id` LEFT JOIN `exp_member_data` ON `exp_member_data`.`member_id` = `exp_members`.`member_id` WHERE `exp_comments`.`comment_id` IN () ORDER BY `comment_date` asc
Filename: modules/comment/mod.comment.php
Line Number: 647Any ideas?
#8 / Aug 31, 2011 6:47am
Hmm may be a bug in EE. Does it work fine without the pagination? Could be useful posting your full template code
#9 / Aug 31, 2011 6:48am
I think it was a bug, I have ‘played’ around… so god knows what I did, but its working (ish)
Thanks
#10 / Aug 31, 2011 2:40pm
Hi Chris,
Just wanted to see if you still have any issues with this matter? If not then I will close out this thread.
Thanks.
Mark
#11 / Aug 31, 2011 2:55pm
Hi Mark. I am still having some issues.
In the user guide it shows the pagination next and prev like this:
{paginate}
{if previous_page}
<a href="http://{auto_path}">Previous Page</a>
{/if}
{if next_page}
<a href="http://{auto_path}">Next Page</a>
{/if}
{/paginate}The problem is, I want to have prev on the left, and next on the right.
I tried:
{paginate}
{if previous_page}
<a href="http://{auto_path}">Previous Page</a>
{/if}
{/paginate}and
{paginate}
{if next_page}
<a href="http://{auto_path}">Next Page</a>
{/if}
{/paginate}but it doesnt seem to work.
Can there only be one set of open and close {paginate} on a page?
Thanks
#12 / Aug 31, 2011 6:30pm
Hi chris - yes you can only have one paginate var inside a channel entries tag. What you are trying to do sounds easy with some CSS, just give the a tags a css class/ID and float them left or right
#13 / Aug 31, 2011 6:45pm
Hi Chris,
Dave is right here. Thanks for the help Dave!
You can indeed only use the {paginate} variable pair once inside the Channel Entries Tag. If you have more than one in there then ExpressionEngine will just ignore them all but one.
As mentioned by Dave you can use some CSS to place the pagination links where you want.
Does that help at all?
Mark
#14 / Sep 01, 2011 4:04am
Thanks Dave and Mark. I have styled it with CSS and its getting nearly how I need it.
Thanks again!
#15 / Sep 01, 2011 5:50am
Excellent news!
Glad that’s got you squared away. Thanks for the help there Dave.
I’ll go ahead and close this thread out as it’s more of a how to now but if you do have any more technical questions then please do feel free to post another thread.
Cheers,
Mark