SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Oop

Threaded View

  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Oop

    I have a shopping cart that is written oldschool (procedural) style PHP and I am trying to convert it to OOP PHP and learning as I go. Anyone interested in giving me a few pointers?

    For example:

    Code:
    <?php
    
    class Pagination {
    
    	var $numrows;
    	var $rowsperpage;
    	var $totalpages;
    
            function SetPagination () {
    
    	$this->numrows = 50;
            $this->rowsperpage = 12;   
            $this->totalpages = ceil($this->numrows / $this->rowsperpage); 
       }
    
    }
    
    ?>
    Code:
    <?php
    	 $page = new Pagination();
    	 $page->SetPagination();
    
    	 echo "numrows: " . $page->numrows . "<br />";
             echo "rowsperpage: " . $page->rowsperpage . "<br />";
    	 echo "totalrows: " . $page->totalrows;
        ?>
    why does $totalrows echo null?
    Last edited by berliner_kindl; Apr 30, 2009 at 20:38.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •