Easy integration of Zend Framework library into WordPress, making it available for themes and other plugins.
You can use the Zend Framework in both themes and other plugins. Here are some simple examples of its use in a theme context.
Simple Example 1 - Database Query:
<?php
if(defined('WP_ZEND_LIBRARY')) {
// display Zend version number
echo Zend_Version::getLatest();
if(defined('WP_ZEND_LIBRARY_DB')) {
// list WordPress usernames
$results = $db->query('SELECT * FROM wp_users');
while ($row = $results->fetch()) {
echo '<p>'.$row['user_login'].'</p>';
}
}
}
?>
Simple Example 2 - Pagination:
<?php
if(defined('WP_ZEND_LIBRARY')) {
// Create an array with numbers 1 to 100
$data = range(1, 100);
// Get a Paginator object using Zend_Paginator's built-in factory.
$paginator = Zend_Paginator::factory($data);
// Select the second page
$paginator->setCurrentPageNumber(2);
echo '<ul>';
// Render each item for the current page in a list-item
foreach ($paginator as $item) {
echo '<li>' . $item . '</li>';
}
echo '</ul>';
}
?>