Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can split out the $files array with one of the following , both of these methods require a $page variable to be set that would be an integer showing which 10 xml file page you want to view. </p> <pre><code>// this will make files an array for 10 element $files = glob('docs/*.xml'); $files = array_chunk($files, 10); foreach($files[$page-1] as $file){ $xml = new SimpleXMLElement($file, 0, true); echo' &lt;tr&gt; &lt;td&gt;' . $xml-&gt;doctype . '&lt;/td&gt; &lt;td&gt;&lt;a href="viewdoc.php?docname=' . basename($file, '.xml') . '&amp;username='. $xml-&gt;startedby .'&amp;myname='. $_SESSION['username'] .'"&gt;' . basename($file, '.xml') . '&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;a href="viewprofile.php?name='. $xml-&gt;startedby .'"&gt;'. $xml-&gt;startedby .'&lt;/a&gt;&lt;/td&gt; &lt;td&gt;'. $xml-&gt;date .'&lt;/td&gt; &lt;td&gt;* * * * *&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt; '; } </code></pre> <p>Or you could use array slice to get whichever 10 you wanted</p> <pre><code>$files = glob('docs/*.xml'); $files = array_slice($files, ($page-1)*10, 10); foreach ($files as $file){ $xml = new SimpleXMLElement($file, 0, true); echo' &lt;tr&gt; &lt;td&gt;' . $xml-&gt;doctype . '&lt;/td&gt; &lt;td&gt;&lt;a href="viewdoc.php?docname=' . basename($file, '.xml') . '&amp;username='. $xml-&gt;startedby .'&amp;myname='. $_SESSION['username'] .'"&gt;' . basename($file, '.xml') . '&lt;/a&gt;&lt;/td&gt; &lt;td&gt;&lt;a href="viewprofile.php?name='. $xml-&gt;startedby .'"&gt;'. $xml-&gt;startedby .'&lt;/a&gt;&lt;/td&gt; &lt;td&gt;'. $xml-&gt;date .'&lt;/td&gt; &lt;td&gt;* * * * *&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt; '; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload