PHP Classes

File: fwphp/glomodul/z_examples/book_video/auction_wrox24h_30/content/articles.php

Recommend this page to a friend!
  Classes of Slavko Srakocic  >  B12 PHP FW  >  fwphp/glomodul/z_examples/book_video/auction_wrox24h_30/content/articles.php  >  Download  
File: fwphp/glomodul/z_examples/book_video/auction_wrox24h_30/content/articles.php
Role: Example script
Content type: text/plain
Description: Example script
Class: B12 PHP FW
Manage database records with a PDO CRUD interface
Author: By
Last change:
Date: 3 months ago
Size: 1,052 bytes
 

Contents

Class file image Download
<?php
/**
 * articles.php
 *
 * Content for Articles
 *
 * @version 1.2 2011-02-03
 * @package Smithside Auctions
 * @copyright Copyright (c) 2011 Smithside Auctions
 * @license GNU General Public License
 * @since Since Release 1.0
 */
$accessLevel = Contact::accessLevel();
if (
$accessLevel != 'Admin') :
  echo
'Sorry, no access allowed to this page';
else :

// Get the article information
$items = Article::getArticles();
if (empty(
$items)) {
 
$items = array();
}
?>
<h1>Articles
    <a class="button" href="index.php?content=articlemaint&id=0">Add</a>
</h1>

<ul class="ulfancy">
  <?php foreach ($items as $i=>$item) : ?>
<li class="row<?php echo $i % 2; ?>">
      <h2><?php echo htmlspecialchars($item->getTitle()); ?>
<a class="button"
          href="index.php?content=articledelete&id=<?php echo $item->getId(); ?>">Delete</a>
        <a class="button"
          href="index.php?content=articlemaint&id=<?php echo $item->getId(); ?>">Edit</a>
      </h2>
    </li>
  <?php endforeach; ?>
</ul>

<?php endif; ?>

For more information send a message to info at phpclasses dot org.