Log in Register FAQ Memberlist Search Welcome to RCF - WHF Forum Index
alt : test.swf
Welcome to RCF - WHF
4fx3.gif 
calendar_open_closeCalendar 
[Solved] GoTO Specific Page MOD question.
Post new topic   Reply to topic View previous topic :: View next topic
Welcome to RCF - WHF Forum Index -> Area 51 - phpBB & Easymod Tech Support Add To Bookmarks
[Solved] GoTO Specific Page MOD question.
PostPosted: 05/09/2007 1:27 AM Reply with quote
Sparrow
Dogs and things
Sparrow
Posts 45
Word Cnt. 5,039
BDay N/A
Sign N/A
Sex Sex:Male
Joined: Sep 24, 2006
Local time: 8:44 PM
spainC1.gif
Hi,

I just installed this MOD and allthough it´s a simple as can be, I´m not able to see how I can put the dropdown after the normal pagination, like you put it on your board.

Can you tell me the trick?

Here´s the pagination part of functions.php:
Code:
//
// Pagination routine, generates
// page number sequence
//
function generate_pagination($base_url, $num_items, $per_page, $start_item, $add_prevnext_text = TRUE)
{
   global $lang;

   $total_pages = ceil($num_items/$per_page);

   if ( $total_pages == 1 )
   {
      return '';
   }

   $on_page = floor($start_item / $per_page) + 1;

   $page_string = '';
   if ( $total_pages > 10 )
   {
      $init_page_max = ( $total_pages > 3 ) ? 3 : $total_pages;

      for($i = 1; $i < $init_page_max + 1; $i++)
      {
         $page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a href="' . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>';
         if ( $i <  $init_page_max )
         {
            $page_string .= ", ";
         }
      }

      if ( $total_pages > 3 )
      {
         if ( $on_page > 1  && $on_page < $total_pages )
         {
            $page_string .= ( $on_page > 5 ) ? ' ... ' : ', ';

            $init_page_min = ( $on_page > 4 ) ? $on_page : 5;
            $init_page_max = ( $on_page < $total_pages - 4 ) ? $on_page : $total_pages - 4;

            for($i = $init_page_min - 1; $i < $init_page_max + 2; $i++)
            {
               $page_string .= ($i == $on_page) ? '<b>' . $i . '</b>' : '<a href="' . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>';
               if ( $i <  $init_page_max + 1 )
               {
                  $page_string .= ', ';
               }
            }

            $page_string .= ( $on_page < $total_pages - 4 ) ? ' ... ' : ', ';
         }
         else
         {
            $page_string .= ' ... ';
         }

         for($i = $total_pages - 2; $i < $total_pages + 1; $i++)
         {
            $page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>'  : '<a href="' . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>';
            if( $i <  $total_pages )
            {
               $page_string .= ", ";
            }
         }
      }
   }
   else
   {
      for($i = 1; $i < $total_pages + 1; $i++)
      {
         $page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a href="' . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>';
         if ( $i <  $total_pages )
         {
            $page_string .= ', ';
         }
      }
   }

   if ( $add_prevnext_text )
   {
      if ( $on_page > 1 )
      {
         $page_string = ' <a href="' . append_sid($base_url . "&start=" . ( ( $on_page - 2 ) * $per_page ) ) . '">' . $lang['Previous'] . '</a>&nbsp;&nbsp;' . $page_string;
      }

      if ( $on_page < $total_pages )
      {
         $page_string .= '&nbsp;&nbsp;<a href="' . append_sid($base_url . "&start=" . ( $on_page * $per_page ) ) . '">' . $lang['Next'] . '</a>';
      }

   }

   /// --- BEGIN MOD: Goto specific page
   if ( $total_pages > 5 )
   {   
      $select_page = ' <select name="generate_pagination" onChange="if(this.options[this.selectedIndex].value != -1){ window.location = this.options[this.selectedIndex].value; }">';
      for($i = 1; $i <= $total_pages; $i++)
      {
         $selected = ( $i == $on_page ) ? ' selected="selected"' : ''; // highlight current page by default
         $select_page .= '<option value="' . append_sid($base_url . "&amp;start=" . ( ( $i - 1 ) * $per_page ) )  . '"' . $selected . '>' . $i . '</option>';
      }
      $select_page .= '</select>:';
   }
   else
      $select_page = '';
   /// --- END MOD: Goto specific page
   
   $page_string = $lang['Goto_page'] . $select_page . ' ' . $page_string;

   return $page_string;
}
Back to Top
View user's profile Find all posts by Dogs and things Send private message   Visit poster's website
Re: [Solved] GoTO Specific Page MOD question.
PostPosted: 05/09/2007 10:04 AM Reply with quote
Citation
poomerio
Citation
Posts 407
Word Cnt. 10,993
BDay May 28
Sign Gemini
Sex Sex:Male
Joined: Feb 25, 2007
Local time: 6:44 PM
Location: SE England
greatbrE.gif
I'm guessing that you edit:
Code:
/templates/template_name/viewtopic_body.tpl


Use a dropdown menu where you want the dropdown to be.
Sorry I couldn't be of any more help Smile

/2¢

- Poomie
Back to Top
View user's profile Find all posts by poomerio Send private message   Phoogle Map
Re: [Solved] GoTO Specific Page MOD question.
PostPosted: 05/09/2007 4:01 PM Reply with quote
Sparrow
Dogs and things
Sparrow
Posts 45
Word Cnt. 5,039
BDay N/A
Sign N/A
Sex Sex:Male
Joined: Sep 24, 2006
Local time: 8:44 PM
spainC1.gif
Thanks Poomie,

What happens with this MOD is that the only edit it requieres is the one posted above, in functions.php. grommit
Back to Top
View user's profile Find all posts by Dogs and things Send private message   Visit poster's website
Re: GoTO Specific Page MOD question.
PostPosted: 05/10/2007 12:28 AM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 2:44 PM
Location: St Pete, FL
peace.gif
This is how I did it:

OPEN
includes/functions.php

FIND
Code:
$page_string = $lang['Goto_page'] . $select_page . ' ' . $page_string;

REPLACE WITH
Code:
$page_string = $lang['Goto_page'] . ': ' . $page_string . '  ' . $select_page;

Save and upload back to the includes folder.  Make sure that you created a good backup of your current functions.php file before you overwrite it with this modified version...

headbang
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: [Solved] GoTO Specific Page MOD question.
PostPosted: 05/10/2007 2:01 AM Reply with quote
Sparrow
Dogs and things
Sparrow
Posts 45
Word Cnt. 5,039
BDay N/A
Sign N/A
Sex Sex:Male
Joined: Sep 24, 2006
Local time: 8:44 PM
spainC1.gif
That was it,

Now when I look at the change I see what I didn´t on my own.

Nice job, thanks, have a nice day! wave
Back to Top
View user's profile Find all posts by Dogs and things Send private message   Visit poster's website
Re: GoTO Specific Page MOD question.
PostPosted: 05/10/2007 2:08 AM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 2:44 PM
Location: St Pete, FL
peace.gif
It wasn't immediately obvious of what to do.  But now that you have seen the change, it can look that way...

I'm glad that worked for you...

Dancing  Dancing  Dancing  Dancing  Dancing
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
 Post new topic  Reply to topic
Information
Welcome to RCF - WHF Forum Index -> Area 51 - phpBB & Easymod Tech Support

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 cannot download files in this forum
All times are GMT - 5 Hours

Page 1 of 1


Add To Bookmarks

 
  
  


  Google

Powered by phpBB © 2001, 2005 phpBB Group

Page generation time: 0.0609s (PHP: 81% - SQL: 19%) - SQL queries: 45 - GZIP disabled - Debug on