Contents Plugin
A content management plugin that enables developers to create and manage websites, news sections, and blogs. This plugin provides a flexible and extensible way to handle different types of content with support for various content sources and user permissions.
Features
- Multiple content types support:
- Database content (
db
) - File-based content (
file
) - PHP dynamic pages (
php
) - Plugin-based content (
plugin
) - Built-in search functionality
- Pagination support
- Tag management system
- User role-based access control
- SEO metadata management
- Breadcrumb support
- Template customization
- Content categorization by sections
Installation
- Place the plugin in your project's
Plugins/Contents
directory - Configure the base path for content files (optional)
Configuration
Default Content Path
By default, the plugin looks for content files in:
[PROJECT_ROOT]/static/contents/
Custom Content Path
To override the default content path, define the following constant in your application:
define('PLUGIN_CONTENTS_BASE_PATH', '/your/custom/path/to/contents/')
Usage
Content Types
- Database Content (
db
) - Store content directly in the database
-
Supports HTML content with automatic escaping
-
File Content (
file
) - Serve content from static files
- Files should be placed in the configured content directory
-
Supports HTML files
-
PHP Dynamic Pages (
php
) - Create dynamic content using PHP
- Supports custom templates and logic
-
Files should be placed in the configured content directory
-
Plugin Content (
plugin
) - Integrate with other plugins
- Custom plugin methods can be called to generate content
Template Integration
The plugin provides several template blocks for easy integration:
fetchLatest()
- Display latest content itemsfetchTagsBlock()
- Display content tagsfetchSearchBlock()
- Add search functionalityfetchContents()
- Display content itemsfetchPaginationBlock()
- Add pagination controls
URL Structure
Content pages are accessible via the following URL pattern:
/content/{content_identifier}/
Management Interface
The plugin includes a management interface accessible at:
/manage/contents/
For tag management:
/manage/contents/tags/
Security
- Content is automatically escaped to prevent XSS attacks
- User role-based access control for content visibility
- Secure handling of file paths and content