我一直在尝试Twig,它适用于我的小网站.
这是使用的教程:
http://devzone.zend.com/article/13633
但是,我已经在网上看了一下,找不到任何可以分页的东西.
这是我的代码:
<html>
<head>
<style type="text/css">
table {
border-collapse: collapse;
}
tr.heading {
font-weight: bolder;
}
td {
border: 0.5px solid black;
padding: 0 0.5em;
}
</style>
</head>
<body>
<h2>Automobiles</h2>
<table>
<tr class="heading">
<td>Vehicle</td>
<td>Model</td>
<td>Price</td>
</tr>
{% for d in data %}
<tr>
<td>{{ d.manufacturer|escape }}</td>
<td>{{ d.model|escape }}</td>
<td>{{ d.price|raw }}</td>
</tr>
{% endfor %}
</table>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这是它的PHP编码:
<?php
// include and register Twig auto-loader
include 'Twig/Autoloader.php';
Twig_Autoloader::register();
// attempt a connection
try { …Run Code Online (Sandbox Code Playgroud)