Forum
Previous/Next links
Hi guys!
I have the following subnavigation:
<ul>
<li>
<a href="#">Home</a>
<?php
perch_pages_navigation(array(
'from-path' => '/index',
'levels' => 0
));
?>
</li>
<li><a href="page2.php">Page 2</a></li>
<li><a href="page3.php">Page 3</a></li>
</ul>
The home subnavigation has several pages. I want to set links for previous/next pages in the content of these pages. Can you please tell me what is wrong with the following code?
<a href="<perch:page id="prev_url" type="hidden" encode="false" />">Previous</a>
<a href="<perch:page id="next_url" type="hidden" encode="false" />">Next</a>
Thanks a lot!
The navigation functions don't currently offer any pagination.
Ok. Is there any other way to build this?
What are you trying to achieve?
The home-navigation has several subpages. I want to put on each of them a prev and next link to navigate directly from the bottom of every page through all subpages. The subnavigation itself is set to invisible.
I would have thought you could use
perch_pages_next_page()
andperch_pages_previous_page()
for that.https://docs.grabaperch.com/docs/navigation/perch-pages-previous-page/ https://docs.grabaperch.com/docs/navigation/perch-pages-next-page/
Adding this to the href-tag actually does not work. Maybe there is a problem with the navigation, too. It looks like this:
Only the subnavigation should be editable. The index.php file shows correctly the subnavigation tree. But within the subpages I can't find it any more. Though it is implemented the same way. What could be wrong? Many thanks!
Can you show us the code you're using?
The output in the page view is still weird, but it jumps now to the correct subpage. Here's the a-tag for the next page:
I see the page name and this: "> Any idea?
Can you show me the HTML output?
Ok, not good. Here's the whole navigation... How can we extract the url?
Does
custom.html
output HTML, or just the URL to the page?The output is HTML:
Ok, so it wouldn't make sense to inject that result into the
href
attribute of a link. You need to either change the template you're using, or change how you're outputting the link.I've tried some different things now, nothing good. Do you have an idea how this could be solved? Any help is much appreciated!
Is the link that's being output correct? What problem are you experiencing?
I could finally solve it. Using perch_pages_next_page() and perch_pages_previous_page() is fine. I put them inside divs and styled a custom navigation template. Thanks for your help, Drew!