Search code examples
phpjqueryxmlpagination

paging xml data


how do i implement paging on xml data which is being called through php. i've been trying various jquery pagination on the xml file with no luck.

html/php code reading the xml data:

<div id="display">
        <?php
        error_reporting(E_ALL);
        ini_set("display_errors", 1);

            $xmldoc = new DOMDocument();
            if(!file_exists('test.xml')){
              echo "Sorry this file does not exists!";
              exit();
            } else {
                $xmldoc->load('test.xml', LIBXML_NOBLANKS);

               // Load up the XSL file
                $xslDoc = new DomDocument;
                $xslDoc->load("test.xsl");
                $xsl = new XSLTProcessor;
                $xsl->importStyleSheet($xslDoc);

                // apply the transformation
                echo $xsl->transformToXml($xmldoc);
            } 
         ?>
    </div>

script [one example]:

<script type="text/javascript" src="jquery-1.4.2.js"></script>
<script type="text/javascript" src="paginator.js"></script>
<script type="text/javascript">
    $(function(){ $("#display").pagination(); });
</script>

Solution

  • You need to decide what's going to be on separate pages. That's entirely dependent on the content of the xml file. I don't think you'll find a great general solution.