General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 17th, 2002, 12:42 PM
whalles2 whalles2 is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Location: Ipswich, UK
Posts: 1 whalles2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy RecNav support materials

The article by Joe O'Donnell, 4th April 2002, on RecNav, 'Building A Dynamic MySQL Paging Class With PHP', has a link to the support materials. This link does not go anywhere now.

Where can I get a copy from?

Regards,

Steven

Reply With Quote
  #2  
Old September 17th, 2002, 08:12 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
If it isnt there it means that it was most likely lost in a server crash on our old host, luckly to say were now hosted by modwest , and havent had a problem since.

Reply With Quote
  #3  
Old September 18th, 2002, 03:32 PM
pwebonline pwebonline is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Posts: 1 pwebonline User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry

I am interested in getting the support material for the class RecNav. Does anyone have it or know where to find it?

Reply With Quote
  #4  
Old September 24th, 2002, 10:36 AM
crazytrain81 crazytrain81 is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 232 crazytrain81 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
here it is

of course, you have to go through and tweak your colors and stuff for the default output. you can either pass your templates to it, or definie default templates, or use both, or whatever. you can call the class by doing:
$recs = new RecNav;
$recs->showRecs($dblink,$query,$template1,$template2,$tem plate3,$numrecs);

PHP Code:
<?php

  
// Default number of records
  
define("DEFAULT_NUM_RECS""");
  
define("DEFAULT_TEMPLATE_HEADER""");
  
define("DEFAULT_TEMPLATE""");
  
define("DEFAULT_TEMPLATE_FOOTER""");

    
  class 
RecNav
  
{
    function 
RecNav(&$LinkIdentifier$Query$Template=DEFAULT_TEMPLATE$TemplateHeader=DEFAULT_TEMPLATE_HEADER$TemplateFooter=DEFAULT_TEMPLATE_FOOTER$RecsPerPage=DEFAULT_NUM_RECS$db_object$query_string)
    {
      
// Validate constructor parameters
      
if(!@mysql_query("SELECT 1"$LinkIdentifier))
      { die(
"MYSQL link identifier is invalid"); }
      else
      {  
        
$this->__linkId $LinkIdentifier;
      }
      
      if(!
ereg("^SELECT"$Query))
        { die(
"Invalid query: query must start with 'SELECT'"); }
      else
        { 
$this->__query $Query; }
        
      if(
$Template == "")
        { 
$this->__template DEFAULT_TEMPLATE; }
      else
        { 
$this->__template $Template; }

      if(
$TemplateHeader == "")
        { 
$this->__templateHeader DEFAULT_TEMPLATE_HEADER; }
      else
        { 
$this->__templateHeader $TemplateHeader; }

      if(
$TemplateFooter == "")
        { 
$this->__templateFooter DEFAULT_TEMPLATE_FOOTER; }
      else
        { 
$this->__templateFooter $TemplateFooter; }
        
      if(!
is_numeric($RecsPerPage) || $RecsPerPage 1)
        { 
$this->__recsPerPage DEFAULT_NUM_RECS; }
      else
        { 
$this->__recsPerPage $RecsPerPage; }
      if(!
$query_string == "N\A")
        { 
$this->__querystring $query_string
                
$this->__dbObject $db_object; }
            else
         { 
$this->__querystring 0;
                
$this->__dbObject 0; }
    }
    

   
    function 
ShowRecs($Page=1)
    {
      
// Using the classes variables and the $Page variable,
      // the ShowRecs function will query the database and
      // return the records based on the $__template variable.
      
      
$finalOutput $this->__templateHeader;
      
      if(
$Page <= 1)
        {
          
$Page 1;
          
$query $this->__query " LIMIT 0, " $this->__recsPerPage;
        }
      else
        { 
$query $this->__query " LIMIT " . (($Page-1) * $this->__recsPerPage) . ", " $this->__recsPerPage; }

      
$result mysql_query($query);
      
$hasRecords mysql_num_rows($result) == false true;
     
      
      if(
$hasRecords)
      {
        
// At least one records returned from the query
        
while($row mysql_fetch_row($result))
        {
         
$newRow $this->__template;

          for(
$i 0$i mysql_num_fields($result); $i++)
           { 
               
$newRow str_replace("<| row" $i " |>"$row[$i], $newRow);
           }
        
          
$finalOutput .= $newRow;
        }
      }
      
      else
      {
        
// No records returned from the query
        
$newRow $this->__template;
        
$newRow str_replace("<| row0 |>""No records found"$newRow);
        
        
// Replace all template tags with &nbsp;
        
$newRow ereg_replace("<\| row[0-9] \|>""&nbsp;"$newRow);

        
$finalOutput .= $newRow;
      }
      
      
$finalOutput .= $this->__templateFooter;
      
      
// Build the recordset paging links
      
$numTotalRecs mysql_num_rows(mysql_query($this->__query));
      
$numPages ceil($numTotalRecs $this->__recsPerPage);
      
$nav "";
      
      
// Can we have a link to the previous page?
      
if($Page 1)
        
$nav .= "<td class='pagenum'><a href='$PHP_SELF?page=" . ($Page-1) . "'><<</td> ";

      for(
$i 1$i $numPages+1$i++)
      {
        if(
$Page == $i)
        {
          
// Bold the page and dont make it a link
          
$nav .= " <td class='pagenum'><h6>$i</h6></td> ";
        }
        else
        {
          
// Link the page
          
$nav .= " <td class='pagenum'><a href='$PHP_SELF?page=$i'>$i</a></td> ";
        }
      }

      
// Can we have a link to the next page?
      
if($Page $numPages)
        
$nav .= " <td class='pagenum'><a href='$PHP_SELF?page=" . ($Page+1) . "'>>></a></td>";
        
      
// Strip the trailing pipe if there is one
      
$nav ereg_replace("\|$"""$nav);
      
      
$finalOutput .= "<br><div class='center'><Table border=o bordercolor=#888888 cellspacing=2 cellpadding=2 width=50 height=24><TR><TD class='page'><h6>Pages</td></tr></table><br><Table border=o bordercolor=#888888 cellspacing=2 cellpadding=2 width=50 height=24><TR> $nav</tr></table></div>";
      
      return 
$finalOutput;
    }
    
    var 
$__linkId;
    var 
$__dbType;
    var 
$__query;
    var 
$__template;
    var 
$__templateHeader;
    var 
$__templateFooter;
    var 
$__recsPerPage;
    var 
$__dbObject;
    var 
$__querystring;
    var 
$__queryarray;
  }
?>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > RecNav support materials


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT