LAST SALE DAY! Save up to 50% off!

Switching to Previous or Next article from the Post template

michal84
143 Posts
michal84 posted this 07 April 2024
Ask a Question

Hello Nicepage support,
can you please point me to the correct way, how to add to the template the buttons allowing me to open the previous or next article in the category, as it can be visible in the Default template of Cassiopea in Joomla! 5.0.3 ?

e.g. in the category of the Advertisments and within any of the articles listed there. Please, note, that this is just a development site, there might happen, that the category name or an article might not be stored in the server ( https://www.stránky.com ).

Thanks in advance,
Michal

Hello Nicepage support, can you please point me to the correct way, how to add to the template the buttons allowing me to open the previous or next article in the category, as it can be visible in the Default template of Cassiopea in Joomla! 5.0.3 ? e.g. in the category of the Advertisments and within any of the articles listed there. Please, note, that this is just a development site, there might happen, that the category name or an article might not be stored in the server ( https://www.stránky.com ). Thanks in advance, Michal
Vote to pay developers attention to this features or issue.
3 Replies
Order By: Standard | Newest
Support Team
Support Team posted this 08 April 2024

Michal,

There is no such option out of the box. We have forwarded your issue to the development for possible workaround.

...................................................
Sincerely,
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Michal, There is no such option out of the box. We have forwarded your issue to the development for possible workaround. ................................................... Sincerely, Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp
michal84
143 Posts
michal84 posted this 08 April 2024

AI returns to me the following code. So it might be able just to implement this:

<?php

// Get the current article
$article = JFactory::getDocument()->getBuffer('component');

// Get the previous article
$prevArticle = $article->get('prev');
if ($prevArticle) {

echo '<a href="' . JRoute::_(ContentHelperRoute::getArticleRoute($prevArticle->slug, $prevArticle->catid)) . '">Previous</a>';

}

// Get the next article
$nextArticle = $article->get('next');
if ($nextArticle) {

echo '<a href="' . JRoute::_(ContentHelperRoute::getArticleRoute($nextArticle->slug, $nextArticle->catid)) . '">Next</a>';

}
?>

Thanks for your effort to make this working.
Kind regards,
Michal

AI returns to me the following code. So it might be able just to implement this: <?php // Get the current article $article = JFactory::getDocument()->getBuffer('component'); // Get the previous article $prevArticle = $article->get('prev'); if ($prevArticle) { echo '<a href="' . JRoute::_(ContentHelperRoute::getArticleRoute($prevArticle->slug, $prevArticle->catid)) . '">Previous</a>'; } // Get the next article $nextArticle = $article->get('next'); if ($nextArticle) { echo '<a href="' . JRoute::_(ContentHelperRoute::getArticleRoute($nextArticle->slug, $nextArticle->catid)) . '">Next</a>'; } ?> Thanks for your effort to make this working. Kind regards, Michal
Support Team
Support Team posted this 08 April 2024

Michal,

Thank you! Our dev will analyze the suggestions.

...................................................
Sincerely,
Nicepage Support Team

Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1
Follow us on Facebook: http://facebook.com/nicepageapp

Michal, Thank you! Our dev will analyze the suggestions. ................................................... Sincerely, Nicepage Support Team Please subscribe to our YouTube channel: http://youtube.com/nicepage?sub_confirmation=1 Follow us on Facebook: http://facebook.com/nicepageapp

Last edited 08 April 2024 by Support Team

You must log in or register to leave comments