Phprad Classic Apr 2026
blog-admin/ ├── index.php # Main entry point ├── login.php # Authentication page ├── logout.php # Logout handler ├── menu.php # Navigation menu ├── config.php # Database configuration ├── db_pdo.php # PDO connection class ├── common.php # Common functions ├── classes/ # Business logic classes │ ├── clsCategories.php │ ├── clsPosts.php │ └── clsUsers.php ├── pages/ # Page controllers │ ├── categories_list.php │ ├── posts_add.php │ └── users_edit.php ├── templates/ # Smarty templates │ ├── master.tpl # Master template │ ├── categories_list.tpl │ └── posts_add.tpl └── lang/ # Language files ├── en.php # English ├── es.php # Spanish └── fr.php # French Modifying Generated Code 1. Change Page Layout Edit template files in /templates/ :
if (!$this->category_data) $this->category_data = Category::Find($this->category_id); return $this->category_data;
CREATE TABLE posts ( id INT PRIMARY KEY AUTO_INCREMENT, category_id INT, title VARCHAR(255) NOT NULL, content TEXT, author VARCHAR(100), status ENUM('draft', 'published') DEFAULT 'draft', publish_date DATE, views INT DEFAULT 0, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (category_id) REFERENCES categories(id) ON DELETE SET NULL );
-- Example schema for a blog system CREATE DATABASE blog_system; USE blog_system; CREATE TABLE categories ( id INT PRIMARY KEY AUTO_INCREMENT, name VARCHAR(100) NOT NULL, description TEXT, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); phprad classic
// In project settings, set master-detail relationship $config['master_detail'] = array( 'posts' => array( 'master_table' => 'categories', 'master_key' => 'id', 'detail_key' => 'category_id' ) ); // Override the default query in list page public function OnBeforeListQuery(&$sql, &$params)
* templates/posts_list.tpl * extends file="master.tpl" block name="content" <div class="container-fluid"> <h1>$Page->Title</h1>
// Example: Posts table field configuration - title: Text input, required, max length 255 - content: WYSIWYG editor (TinyMCE) - category_id: Select dropdown from categories table - status: Radio buttons (draft/published) - publish_date: Date picker, default to today - views: Read-only, auto-incrementing integer - created_at: Read-only timestamp Configure access control: blog-admin/ ├── index
return true; Modify class files:
// Custom validation if (strlen($this->title) < 5) $this->SetError("Title must be at least 5 characters"); return false; // Auto-generate slug $this->slug = strtolower(str_replace(' ', '-', $this->title));
<table class="table"> <thead> <tr><th>Month</th><th>Posts</th></tr> </thead> <tbody> <?php while($row = $result->fetch()): ?> <tr> <td><?= $row['month'] ?></td> <td><?= $row['count'] ?></td> </tr> <?php endwhile; ?> </tbody> </table> category_data = Category::Find($this->
* Generated grid * $Grid->Render() </div> /block Modify page controller files:
Configure file fields in project:
// config.php ini_set('display_errors', 1); error_reporting(E_ALL); Solution: Check permissions and paths