I have 100 of php pages and all are just static pages. I wanted to have next/prev page link in each and every page footer that should work automatically rather than setting up manually. All pages will be having the URLs like "components/button", "components/tooltip", "design/tokens", and "Get started"
Same like what Carbon Design System has in the footer.
I wanted to have an easier approach for linking automatically for each component page.
I tried some jQuery but not getting the required results.
2
Answers
Here is a very simple solution I’ve put together. You just need to add each of the pages you want included into the PHP array, and then include the script on each page. Pages are ordered based on their position within the array.
footer-navigation.php:
To add the navigation to each page, place the following in your footer:
Make sure the path is correct for pages not inside the same directory as footer-navigation.php.
This seems to be a duplicate thread, please check out this article.
However, I will still try my hand at this.. You could try to assign your urls to an array… (or even a database).
inside array.inc.php:
inside the footer.php file:
Then, inside a redirect page, nextpage.inc.php, we combine the array into the url:
Previous page is the same, except reduce the $_SESSION["page"] value by 1, and error check for page number less than or equal to "0".
Hope this helps…