Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Post Installation Help
Author Message
helsnicht
Hangin' Around



Joined: Jan 25, 2008
Posts: 44

PostPosted: Wed Oct 01, 2008 7:29 pm Reply with quote

Can someone make this so it displays the info regardless if there is only one page? Here is the code I fount in the functions.php, not for sure if its the only code involved with the pagination thing but its all I've seen so far.

Code:
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 . "&amp;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 . "&amp;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 . "&amp;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 . "&amp;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 . "&amp;start=" . ( ( $on_page - 2 ) * $per_page ) ) . '" style="color:#999999;">' . $lang['Previous'] . '</a>&nbsp;&nbsp;' . $page_string;
      }

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

   }

   $page_string = $lang['Goto_page'] . ' ' . $page_string;

   return $page_string;
}


Like if theres only one page have it display like Page: 1
The reason being is I have it within a box but when it doesn't display it screws it up.

Code:
if ( $total_pages == 1 )

   {
      return '';
   }


I tried adding things to the above part but nothing will show. Btw I'm using RN2.20.10 if that actually matters for anything. Any help is always appreciated.
 
View user's profile Send private message Visit poster's website
helsnicht







PostPosted: Thu Oct 02, 2008 12:49 am Reply with quote

Bump:
Fount a different question to ask, so instead of making a new topic I just edited the one I wanted deleted. =)
 
helsnicht







PostPosted: Sat Oct 11, 2008 12:02 pm Reply with quote

Bump?
I'm referring to this pagination:
Image
 
Susann
Moderator



Joined: Dec 19, 2004
Posts: 3191
Location: Germany:Moderator German NukeSentinel Support

PostPosted: Sat Oct 11, 2008 12:53 pm Reply with quote

Helsnicht

I have a french page but without news page and there its als displayed.
So I´m not exactly sure what you are looking for ?
You can change a few settings in rnconfig.php and two files are in the folder classes.
 
View user's profile Send private message
mars
Worker
Worker



Joined: Jul 08, 2006
Posts: 123
Location: Bloomsburg,Pennsylvania

PostPosted: Sat Oct 11, 2008 1:28 pm Reply with quote

did you try just commenting that part out?

Code:


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


?

_________________
Visit Our PHPNuke Theme Site 
View user's profile Send private message Visit poster's website
helsnicht







PostPosted: Sun Oct 12, 2008 12:29 pm Reply with quote

Thanks for the replies. Never even dawned on me to comment it out mars, thanks. That made it show exactly the way I wanted.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Post Installation Help

View next topic
View previous topic
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 can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©