I got the code below to split pages:
$files = glob('docs/*.xml');
$files = array_slice($files, ($page-1)*10, 10);
foreach ($files as $file){
$xml = new SimpleXMLElement($file, 0, true);
echo'
<tr>
<td>' . $xml->doctype . '</td>
<td><a href="viewdoc.php?docname=' . basename($file, '.xml') . '&username='. $xml->startedby .'&myname='. $_SESSION['username'] .'">' . basename($file, '.xml') . '</a></td>
<td><a href="viewprofile.php?name='. $xml->startedby .'">'. $xml->startedby .'</a></td>
<td>'. $xml->date .'</td>
<td>* * * * *</td>
<td></td>
</tr>
';
}
But now I'm not sure how can I add pages links (Such as 1 2 3 4 Next
) to this code
I've thought about adding ++ to variable but that didn't worked to me.
My question is how can I add pages links in loop way?
Thanks in advance.
EDIT: I forgot to tell you the all the stuff in echo suppost to be the page (10 files in 1 page)
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>Next</li>
</ul>