Location: PHPKode > projects > ProjectPress > projectpress/pm-admin/manage_news.php
<?php 
/**
 * ProjectPress manage news
 *
 * @package ProjectPress
 * @since 2.0
 */

// Starts the session.
session_start();

define('access',true);

include(dirname(dirname(__FILE__)) . '/config.inc.php');
require_once(PM_DIR . 'pm-includes/global.inc.php');
require(PM_DIR . 'pm-includes/functions.php');
include(PM_DIR . 'pm-includes/header.php');

if($current_user->hasPermission('add_news') != true) { pm_redirect(PM_URI . '/index.php'); }

// Enable for error checking and troubleshooting.
# display_errors();

?>

				<div id="page-title">
					<img src="<?php echo PM_URI; ?>/images/newspaper.png" alt="" /><h1>Manage News 
						<?php if($current_user->hasPermission('add_news') == true) {
							echo '<span id="header-link"><a href="' . PM_URI . '/pm-admin/add_news.php">Add News</a></span></h1>'; } ?>
				</div>

				<div id="middle">
				<div id="groups">
						<table cellpadding="0" cellspacing="0" border="0" align="center">
							<th>Title</th>
							<th>Edit</th>
							<th>Delete</th>

<?php
$sql = "SELECT * FROM " . DB . "news ORDER BY newsid ASC";
$result = pmdb::connect()->query($sql);

//Create a PS_Pagination object
$pager = new PS_Pagination(pmdb::connect(),$sql,10,10);

//The paginate() function returns a mysql result set
$sql = $pager->paginate();

if($result->num_rows > 0) {
while($row = $result->fetch_object()) {
        
?>
        		
        <tr>
        	<td><a href="<?php _e(PM_URI); ?>/news/news.php?id=<?php _e($row->newsid); ?>"><?php _e($row->title); ?></a></td> 
        	<td><a href="<?php _e(PM_URI); ?>/pm-admin/edit_news.php?id=<?php _e($row->newsid); ?>">Edit</a></td> 
        	<td><a href="<?php _e(PM_URI); ?>/pm-admin/delete_news.php?id=<?php _e($row->newsid); ?>">Delete</a></td>
        </tr>

<?php 
	}
} else {
  echo '<p>You haven\'t posted any new items.</p>';
}
?>
						</table>
						<!--Display the full navigation in one go-->
						<p>&nbsp;</p>

						<p align="center"><?php _e($pager->renderFullNav()); ?></p>

				</div>
				</div>


<?php

include(PM_DIR . 'pm-includes/footer.php');
Return current item: ProjectPress