Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
Prev - Next links for page break in Full Story! [HowTo]

 
Reply to topic    Forum Index » General feedback View previous topic
View next topic
Prev - Next links for page break in Full Story! [HowTo]
Author Message
DarkSlim



Joined: 06 Aug 2009
Posts: 286
Location: IL

Post Prev - Next links for page break in Full Story! [HowTo] Reply with quote
There was a question (from DistantJ) about making Prev and Next links
in full story (when dividing the post to pages using 'pagebreak' or 'nextpage' as it is also called)
Here is a way to do it:

Open inc/show.news.php

Find (it may look a bit different since I modified it (as I wrote here here) :
Code:

if ($page_count > 1){
            $output = str_replace('[page-link]', '', $output);
            $output = str_replace('[/page-link]', '', $output);

            for ($i = 1; $i < $page_count + 1; $i++){
               if (($page and $page == $i) or ($allow_full_story and !$page and $i == 1)){
                  $pages .= ' <b>'.$i.'</b> ';
               } else {
                  $pages .= ' <a href="'.$PHP_SELF.'?id='.$row[id].'&page='.$i.'">'.$i.'</a> ';
               }
            }


Under Add:
Code:

                                        //DarkSlim's code for next/prev links in full story
                                              if(isset($page)){
                                                if ($page != $page_count){
                                                  $nextc = $page + 1;
                                                 $nextpage .= '<a href="'.$PHP_SELF.'?id='.$row[id].'&page='.$nextc.'">NEXT</a>';
                                                }
                                                  if ($page != '1'){
                                                 $prevc = $page - 1;
                                                  $prevpage .= '<a href="'.$PHP_SELF.'?id='.$row[id].'&page='.$prevc.'">PREV</a>';
                                                }
                                              } else {
                                                  $nextc = '2';
                                                 $nextpage .= '<a href="'.$PHP_SELF.'?id='.$row[id].'&page='.$nextc.'">NEXT</a>';
                                                }


* You can change the words NEXT and PREV for whatever you like
You can replace them with image buttons too (html syntax)


Then, Find:
Code:

      $output = str_replace('{pages}', $pages, $output);


After Add:
Code:

        $output = str_replace('{nextpages}', $nextpage, $output);
        $output = str_replace('{prevpages}', $prevpage, $output);


That's it! edit your template and instead of just {pages} use the new tags!
Like this for example:
Quote:
[page-link]{prevpages}({pages}){nextpages}[/page-link]


Use it as you like, hope this helps. Smile

Edit: I fixed a bug in the code when you first enter the post and the $page variable is not yet set
Now it works perfectly (if you have any other questions or suggestions i'de love to hear) Smile

DarkSlim

_________________
Portfolio: www.Yaniv.tk

Some of my Plugins and Mods and more in the CuteNewsRU Index!

Donations Accepted, Thank you

Last edited by DarkSlim on Tue Nov 10, 2009 4:53 pm; edited 1 time in total
Mon Nov 02, 2009 5:21 pm View user's profile Send private message Visit poster's website
Guest








Please login to hide the ads.

DarkSlim



Joined: 06 Aug 2009
Posts: 286
Location: IL

Post Reply with quote
Any moderator can move this thread to "Suggestions" ? (mistakenly opened it here) Surprised ^^'

_________________
Portfolio: www.Yaniv.tk

Some of my Plugins and Mods and more in the CuteNewsRU Index!

Donations Accepted, Thank you
Tue Nov 10, 2009 4:52 pm View user's profile Send private message Visit poster's website
Display posts from previous:    
Reply to topic    Forum Index » General feedback All times are GMT + 1 Hour
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum



Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Music Lyrics.