View Single Post
  #5  
Old 07-26-2000, 07:22 PM
Guest
 
Posts: n/a
Default

Well, I have not tried to change the query, although it was with that intention that I openned the script for modification. I ended up adding a much nicer navigation bar.

To use it, find your favourite First, Previous, Next and Last graphics and replace nav_first_on.gif, nav_first_off.giff, nav_prev_on.gif, &c, in the following code. I added one more variable, $smilieslinklast, to determine whether or not to enable the navigation for the last page button.
Code:
if ($action=="showsmilies") {

// 2000-07-26 PEH - hacked to add LIMIT clause to break up ShowSmilies page
  if (!isset($startsmilies)) {
    $startsmilies=0;
  }

// added LIMIT statement, hard coded "30" as the per page value
// (should move this to a variable in the control panel, though)
  $smilies=$DB_site->query("SELECT smilietext,title,smiliepath FROM smilie ORDER BY title LIMIT $startsmilies,30");
  while ($smilie=$DB_site->fetch_array($smilies)) {
    $smilietext=$smilie[smilietext];
    $smiliepath=$smilie[smiliepath];
    $title=$smilie[title];

    eval("\$smiliebits .= \"".gettemplate("smiliebit")."\";");
  }

// $smiliescount is the total number of smilies in the database
  $smiliescountresult=$DB_site->query("SELECT COUNT(*) AS Total FROM smilie");
  $smiliescountrow=$DB_site->fetch_array($smiliescountresult);
  $smiliescount=$smiliescountrow["Total"];

// display the current range for information only
  $smilieslink .= "Smilies " . ($startsmilies+1) . " to " . min(($startsmilies+30),($smiliescount+0)) . " of " . $smiliescount . "<br>";

// display a link to the previous page, if needed
  if ($startsmilies>29) {
    $linkstartsmilies=$startsmilies-30;
    $smilieslink .= "<a HREF=\"index.php?action=showsmilies&startsmilies=0\"><img src=\"images/nav_first_on.gif\" border=0 alt=\"First Page\"></a>";
    $smilieslink .= "<a HREF=\"index.php?action=showsmilies&startsmilies=$linkstartsmilies\"><img src=\"images/nav_prev_on.gif\" border=0 alt=\"Previous Page\"></a>";
  } else {
    $smilieslink .= "<img src=\"images/nav_first_off.gif\" border=0 alt=\"At first page, already\">";
    $smilieslink .= "<img src=\"images/nav_prev_off.gif\" border=0 alt=\"At first page, already\">";
  }

// display a link to the next page, if needed
  if ($startsmilies<$smiliescount-30) {
    $linkstartsmilies=$startsmilies+30;
    $smilieslink .= "<a HREF=\"index.php?action=showsmilies&startsmilies=$linkstartsmilies\"><img src=\"images/nav_next_on.gif\" border=0 alt=\"Next Page\"></a>";
  } else {
    $smilieslink .= "<img src=\"images/nav_next_off.gif\" border=0 alt=\"At last page, already\">";
  }

// add the "Last Page" link
    $smilieslinklast=$smiliescount-$smiliescount%30;
  if ($smilieslinklast>$startsmilies) {
    $smilieslink .= "<a HREF=\"index.php?action=showsmilies&startsmilies=" . $smilieslinklast . "\"><img src=\"images/nav_last_on.gif\" border=0 alt=\"Last Page\"></a>";
  } else {
    $smilieslink .= "<img src=\"images/nav_last_off.gif\" border=0 alt=\"At last page, already\">";
  }

  eval("echo dovars(\"".gettemplate("smilies")."\");"); // added line to "smilies" to show link to previous and/or next page
}
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01900 seconds
  • Memory Usage 1,775KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete