分页 xml 数据
如何对通过 php.ini 调用的 xml 数据实现分页?我一直在 xml 文件上尝试各种 jquery 分页,但没有成功。
读取 xml 数据的 html/php 代码:
<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 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>
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要决定哪些内容将出现在不同的页面上。这完全取决于 xml 文件的内容。我认为您不会找到一个很好的通用解决方案。
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.