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

  1. Place the plugin in your project's Plugins/Contents directory
  2. 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

  1. Database Content (db)
  2. Store content directly in the database
  3. Supports HTML content with automatic escaping

  4. File Content (file)

  5. Serve content from static files
  6. Files should be placed in the configured content directory
  7. Supports HTML files

  8. PHP Dynamic Pages (php)

  9. Create dynamic content using PHP
  10. Supports custom templates and logic
  11. Files should be placed in the configured content directory

  12. Plugin Content (plugin)

  13. Integrate with other plugins
  14. Custom plugin methods can be called to generate content

Template Integration

The plugin provides several template blocks for easy integration:

  • fetchLatest() - Display latest content items
  • fetchTagsBlock() - Display content tags
  • fetchSearchBlock() - Add search functionality
  • fetchContents() - Display content items
  • fetchPaginationBlock() - 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