Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

PHPCMS V9 Framework Structure and Secondary Development Guide

Tech May 10 3

Root Directory Overview

/
|-- api                  # External interface scripts
|-- caches               # Temporary cached data
|   |-- configs_*        # System cache storage
|-- configs              # Core configuration files
|-- phpcms               # Main framework source code
|   |-- languages        # Localization files
|   |-- libs             # Core libraries and helpers
|   |-- model            # Database abstraction layer
|   |-- modules          # Application modules
|   |-- templates        # Frontend and backend views
|-- phpsso_server        # SSO authentication system
|-- statics              # Static assets (CSS, JS, Images)
|-- uploadfile           # User uploaded files
|-- admin.php            # Backend login entry
|-- index.php            # Frontend bootstrap
|-- crossdomain.xml      # Flash cross-domain policy
|-- robots.txt           # Search engine crawler rules
|-- favicon.ico          # Browser tab icon

Configuration Cache Details

The caches/configs_commons/caches_data directory stores serialized settings generated from the admin panel:

  • category_content.cache.php: Mapping between sections and websites.
  • category_content_1.cache.php: Detailed settings for all sections in Site ID 1.
  • category_item_1.cache.php: Statistics for the Article model.
  • category_item_2.cache.php: Statistics for the Download model.
  • category_item_3.cache.php: Statistics for the Image model.
  • model.cache.php: Configuration for the three default content models.
  • sitelist.cache.php: Basic configuration for all registered websites.
  • urlrules.cache.php: URL generation patterns.
  • role.cache.php: Administrator role permissions.
  • special.cache.php: Special topic configurations.

The caches/configs_model/caches_data directory handles field definitions:

  • content_form.class.php: Logic to render HTML forms.
  • content_input.class.php: Validdation logic before saving to DB.
  • content_output.class.php: Data formatting for display.
  • model_field_1.cache.php: Field definitions for the Article model.
  • model_field_2.cache.php: Field definitions for the Download model.
  • model_field_3.cache.php: Field definitions for the Image model.

Core Libraries (phpcms/libs)

phpcms/libs
|-- classes
|   |-- application.class.php   # App routing and lifecycle
|   |-- param.class.php         # URL parameter parsing
|   |-- form.class.php          # HTML form generator
|   |-- image.class.php         # Image manipulation (GD/Imagick)
|   |-- attachment.class.php    # File upload handler
|-- functions
|   |-- global.func.php         # Common utility functions
|   |-- extension.class.php     # Extendable helper functions

Module Structure (phpcms/modules)

Modules follow a standard MVC structure. Below is an example to the content module:

phpcms/modules/content
|-- index.php           # Controller (handles requests)
|-- classes             # Module-specific libraries
|-- fields              # Custom field type logic
|-- functions           # Module-specific helpers
|-- templates           # Backend view files

Template Customization (phpcms/templates)

You can create new template styles or override existing ones.

Option 1: New Style Directory

phpcms/templates/new_style
|-- content
|   |-- category.html   # Channel page
|   |-- list.html       # Listing page
|   |-- show.html       # Detail page
|-- config.php          # Register the 'new_style' template

Option 2: Override Default Files

phpcms/templates/default
|-- content
|   |-- category_custom.html  # Custom channel template
|   |-- list_custom.html      # Custom list template
|   |-- show_custom.html      # Custom detail template
|-- config.php                # Map new files in config

Static Assets

Place custom project assets in the statics directory to keep them separate from core updates:

statics
|-- css
|   |-- project_styles.css
|-- js
|   |-- project_scripts.js
|-- images
|   |-- project_logo.png

URL Routing Syntax

PHPCMS uses a query string approach for routing:

http://domain.com/index.php?m=module_name&c=controller_name&a=action_name&catid=123
  • m: Module (e.g., content).
  • c: Controller (e.g., index).
  • a: Action method (e.g., init).
  • Additional parameters (e.g., catid) are passed as standard GET variables.

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.