![]() |
Help with class....
Ok, I am working on a pagination class, I figured I will break up the "methods" and figure them out one at a time instead of trying to write a class with 10+ methods...so I am going to do one at a time, make sure I get the results, and eventually combine everything together.
But I am having a problem already, I keep getting a blank page. Here's my class file. Code:
<?Here's my HTML. Code:
<?Since the current page is set to 7. I am giving it the last page which is 10, and the current page 7. So anyways, the output should be: 5 6 7 8 9 But instead it's just blank?? |
Sorry, it's not blank, I was looking at the wrong browser.
I'm getting a parse error... Parse error: syntax error, unexpected T_VARIABLE in /usr/local/apache/public/paginate.html on line 17 |
Ok I got it working but I had to remove the INT from the function calls.
So in the HTML, I had to do this: $display_links = $pagination->getPageLinks($page_last,$get_page); Instead of: $display_links = $pagination->getPageLinks(int $page_last, int $get_page); And in the class, I had to use this: public function getPageLinks($page_last, $get_page) { Instead of this: public function getPageLinks(int $page_last,int $get_page) { But I don't understand, I thought it was proper coding to type hint the attributes? |
Quote:
|
Quote:
|
One thing to keep in mind though, is that every classvariable ($this->classvariable) should be declared in the beginning of the class.
Like such: PHP Code:
Also note that it will work even if you don't declare them, however the PHP will work faster if you declare them, so just an advice. |
Quote:
I think writing a pagination class script is a good way to learn OO. Much better than doing a "hello world" in OO.... |
| All times are GMT. The time now is 06:35 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0