Phprad Classic Apr 2026

<!-- Custom HTML/PHP here --> <h2>Monthly Sales</h2> <?php // Your custom query $result = $DB->Execute("SELECT MONTH(publish_date) as month, COUNT(*) as count FROM posts GROUP BY MONTH(publish_date)"); ?>

$sql = "SELECT p.*, c.name as category_name FROM posts p LEFT JOIN categories c ON p.category_id = c.id WHERE p.status = 'published'";

// Log the insertion $this->LogActivity("New post created: " . $this->title);

// config.php ini_set('display_errors', 1); error_reporting(E_ALL); Solution: Check permissions and paths phprad classic

// cron/daily_report.php <?php require_once("../config.php"); // Generate and email daily summary $sql = "SELECT COUNT(*) as total FROM posts WHERE DATE(created_at) = CURDATE()"; $result = $DB->Execute($sql); $total = $result->fields['total']; mail("admin@example.com", "Daily Report", "Posts today: " . $total); 1. Enable Caching // config.php $config['cache_enabled'] = true; $config['cache_lifetime'] = 3600; // 1 hour $config['cache_dir'] = 'cache/'; 2. Optimize Database Queries // Add indexes to database tables ALTER TABLE posts ADD INDEX idx_status_publish (status, publish_date); ALTER TABLE posts ADD INDEX idx_category (category_id); 3. Enable Pagination // In list page configuration $config['page_size'] = 20; $config['use_pagination'] = true; 4. Lazy Loading for Related Data // Modify class to load relations on demand public function GetCategory()

return true; Modify class files:

* templates/posts_list.tpl * extends file="master.tpl" block name="content" <div class="container-fluid"> <h1>$Page->Title</h1> Enable Caching // config

// Test connection script try $pdo = new PDO("mysql:host=localhost;dbname=test", "user", "pass"); echo "Connected successfully"; catch(PDOException $e) echo "Error: " . $e->getMessage();

1. Modify .htaccess for Security # Deny access to sensitive directories RedirectMatch 403 ^/blog-admin/(classes|templates_c|includes)/.*$ Prevent directory listing Options -Indexes Protect config file <Files config.php> Order allow,deny Deny from all </Files> 2. Enable HTTPS Redirection // common.php - force HTTPS if (!isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] !== 'on') header("Location: https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); exit();

1. Prepare Production Environment # Create production database mysql -u root -p CREATE DATABASE blog_production; GRANT ALL ON blog_production.* TO 'app_user'@'localhost' IDENTIFIED BY 'strong_password'; Export development database mysqldump -u dev_user -p blog_development > database.sql Import to production mysql -u app_user -p blog_production < database.sql 2. Update Configuration // config.php - Production settings $config['db_host'] = 'localhost'; $config['db_user'] = 'app_user'; $config['db_password'] = 'strong_password'; $config['db_name'] = 'blog_production'; $config['debug_mode'] = false; $config['error_reporting'] = E_ALL & ~E_NOTICE & ~E_WARNING; 3. Secure File Permissions # Set proper ownership chown -R www-data:www-data /var/www/blog-admin/ chmod -R 755 /var/www/blog-admin/ chmod -R 770 /var/www/blog-admin/templates_c/ chmod -R 770 /var/www/blog-admin/uploads/ chmod 640 /var/www/blog-admin/config.php 4. Enable Production Cache // config.php $config['smarty_caching'] = true; $config['smarty_cache_lifetime'] = 86400; // 24 hours Troubleshooting Common Issues Problem: White screen after generation Solution: Enable error reporting Lazy Loading for Related Data // Modify class

$to = "admin@example.com"; $subject = "New Post Added: " . $this->title; $message = "A new post has been added by " . $_SESSION['username']; mail($to, $subject, $message);

// Field configuration 'image' => array( 'type' => 'file', 'upload_dir' => 'uploads/', 'allowed_extensions' => 'jpg,jpeg,png,gif', 'max_size' => 5242880, // 5MB 'thumbnail' => array(150, 150), 'medium' => array(800, 600) ) // pages/posts_add.php public function OnAfterSave()