One more question!
This code successfully lets you go backwards and forwards between numbered pages, but I was not expecting it to work well:
public function body()
{
print('Page One<br>');
print('<a '.$this->create_back_href().'>Back</a><br>');
print('<a '.$this->create_callback_href(array($this, 'page'), 2).'>Link to the next page</a><br>');
}
public function page($number)
{
if($this->is_back()) return false;
print('Page '.$number.'<br>');
print('<a '.$this->create_callback_href(array($this, 'page'),$number + 1).'>Link to the next page</a><br>');
print('<a '.$this->create_back_href().'>Back</a>');
return true;
}
I was expecting that when I clicked on 'Back', it would always take me to 'Page One', but instead it stepped backwards from one number to the previous. Why does it do this? Are callback functions somehow chained? How does it not run 'function page()', and still get the previous result?