webweaver Posted September 18, 2013 Posted September 18, 2013 Quick intro: I'm coming to ProcessWire from ModX with no experience in PHP I've setup a portfolio on my testing site. The listing page has pagination with 6 pages per web page. When you click to go to a detail page, I have "Previous" and "Next" button links to traverse the detail pages in the portfolio. You can see an example detail page here http://websiteprofessionalstest.com/our-work/villagio-student-housing/ . The page in the example above is the first page in the array, so I do not want the "Previous Project" button to show. I also do not want the "Next Project" button to show on the last project page. Here is the code I have tried to not show the "Previous Button" on the first page: <?php if ($page->prev->url != $page->url): ?> <div><a class="project" href="<?php echo $page->prev->url; ?>">« Previous Project</a></div> <?php endif; ?> My thinking here is that on the first page the $page->prev->url and the $page->url are the same, so the if statement shouldn't execute. But it doesn't work. My guess is I'm going about this in a completely wrong way. I tried some other things with PageArray, but I guess I don't understand yet how to work with PageArray and WireArray. Any help would be a appreciated. David F
kongondo Posted September 18, 2013 Posted September 18, 2013 Hi David, See this thread and Diogo's response...it should get you on your way... http://processwire.com/talk/topic/3133-detect-first-and-last-sibling-page/ 3
webweaver Posted September 18, 2013 Author Posted September 18, 2013 Thank you for the quick response kongondo, exactly what I was needing - works great.. Btw, kongondo, you were the one who initially got me excited about ModX after I got a handle on Wayfinder using your tutorial. The fact that you're here now is a confirmation that PW is the new game in town 4
kongondo Posted September 18, 2013 Posted September 18, 2013 Small world . Nice to know that the book was helpful, thanks. Well, I think I can say with utmost confidence that I'll never get you excited about another CMS . It's hard to imagine anything better than PW; I haven't found it and am not looking either . David, welcome to awesomeness! aka PW . 4
webweaver Posted September 18, 2013 Author Posted September 18, 2013 It's hard to imagine anything better than PW; I haven't found it and am not looking either . For four years I said the exact same thing about ModX.. Then I stumbled upon an article from someone explaining why they switched to PW.. I reluctantly checked out PW, because I had already fully committed myself to ModX. Like you, I'm very glad to find PW. And also to find such good community support! 1
purwa Posted September 21, 2013 Posted September 21, 2013 Hi! another modx refugee reporting in. we should make club or something lol j/k.
diogo Posted September 21, 2013 Posted September 21, 2013 Welcome to PW purwa! Make sure you read kongondo's new bible http://processwire.com/talk/topic/3691-tutorial-a-quick-guide-to-processwire-for-those-transitioning-from-modx/
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now