Z-BlogPHP Documentation
repository·master·Indexed 21 days ago
https://github.com/zblogcn/zblogphpAn open-source, lightweight CMS designed for high performance and extensibility, primarily targeting the Chinese market. It features a modular 'Lego-like' architecture with rich plugin interfaces and theme templates. Supports PHP 5.2 through 8.4 and multiple databases including MySQL, SQLite, and PostgreSQL. Documentation covers installation, template syntax (variables, control structures, and raw PHP blocks), coding standards based on PSR-2, and system requirements.
What's inside Z-BlogPHP
- Z-BlogPHP is an open-source CMS (Content Management System) designed for high performance, ease of use, and extensibility. It aims to provide a seamless writing experience for users while offering developers powerful customization through rich plugin interfaces and theme templates. It is characterized as a 'Lego-like' website program due to its high playability and modular nature.
Access Z-BlogPHP community and documentation
masterFor support, development, and community engagement, use the following resources:
- Development Documentation: https://docs.zblogcn.com/
- Community Forum: https://bbs.zblogcn.com/ (for general discussion and development suggestions)
- Bug Reporting: Submit bugs via the Z-Blog forum or directly through GitHub Issues.
- Contributions: Pull Requests are welcome on GitHub.
Naming conventions for Z-BlogPHP functions, classes, and variables
masterFollow these naming rules to maintain consistency with the Z-BlogPHP codebase:
Functions
- Use PascalCase (UpperCamelCase).
Classes
- Class Names: The first letter must be capitalized.
- Class Properties: If a property maps to a database field, the property name must match the database field name exactly. For example, the property
mem_IDshould correspond toMember.IDin the database.
Global Variables
- Use all lowercase letters.
Constants
- Use ALL_UPPERCASE with underscores (
_) separating words.
Use variables in Z-BlogPHP templates
masterZ-BlogPHP templates support both outputting variables and defining variables for later use within the template logic.
- Outputting a variable: Use the
{$variable.property}or{$variable}syntax to render the value directly into the HTML. - Defining a variable: Use the
{$variable=value}syntax to assign a value (such as a function result or a string) to a variable without rendering it immediately.
{$article.Name} {$now=time()} {$abc="my name"}- Outputting a variable: Use the
Use Z-BlogPHP standalone utility tools
masterZ-BlogPHP provides several standalone PHP utility files that can be used individually for common administrative tasks. These tools are designed to be run as single files within your Z-BlogPHP installation directory.
Available utilities: - Z-BlogPHP Online Installation Tool: install.php - Z-BlogPHP Password Reset Tool: nologin.php - Z-BlogPHP Plugin Interface Definition Output Tool: pluginlist.phpUse control structures (if, for, foreach) in templates
masterZ-BlogPHP provides template-specific syntax for common programming control structures, allowing you to implement conditional logic and loops directly in your templates.
// If/Else logic {if $i==1} i=1 {elseif $i==2} i=2 {else} i=else {/if} // For loop {for $i = 1 ; $i <= 10 ; $i ++} <p>This is iteration {$i}</p> {/for} // Foreach loop {foreach $articles as $article} <p>{$article.Title}</p> {/foreach}Install Z-BlogPHP
masterPrerequisites
Ensure your website directory has
755permissions.Note for GitHub users: If you are using the development version from GitHub, it is recommended to first download and install the stable version, then overwrite the files with the GitHub version.
Installation Steps
- Upload the Z-BlogPHP program to your website directory.
- Navigate to
http://your-website/in your browser to access the installation interface. - Configure your database:
- MySQL: Enter the MySQL account and password provided by your hosting provider.
- SQLite: Ensure your server supports SQLite; the installer will automatically create the SQLite database file when you proceed.
- PostgreSQL: Enter the hostname, database name, account, and password.
- Set up Administrator Account: Enter the username and password for your site administrator. Use a strong password.
- Click 'Next' to complete the installation.
Post-Installation Cleanup
To secure your installation, delete the following folders:
- Always delete the
zb_installfolder. - If using the GitHub development version, also delete the
standards,tests, andutilsfolders.
Coding standards and file formats for Z-BlogPHP
masterWhen contributing to or extending Z-BlogPHP, follow these formatting and style guidelines to ensure compatibility and consistency.
File Format
- Use UTF-8 encoding.
- Do not include a BOM (Byte Order Mark) header.
Code Style
Z-BlogPHP generally follows the PSR-2 coding standard, with the following specific exceptions and additional rules:
- Line Length: There is no limit to the number of characters per line.
- Backward Compatibility: Code must be written using syntax compatible with PHP 5.2 (e.g., do not use short array syntax
[]or certainusekeyword patterns that require higher versions). - Whitespace: Do not place multiple blank lines before a semicolon.
- Operators: Always place a single space on both sides of an operator.
Access coding standards for Z-BlogPHP applications
masterThe main program coding standards are contained within this repository. For developers building applications or plugins on top of Z-BlogPHP, specific application coding standards are maintained in a separate document to ensure compatibility and consistency with the core system.
https://github.com/zblogcn/zblogphp/blob/master/standards/%E7%BC%96%E7%A0%81%E8%A7%84%E8%8C%83.mdCommunity and Documentation Resources
masterFor further assistance and development, use the following resources:
- General Discussion & Development Suggestions: Z-Blog Forum
- Official Documentation: docs.zblogcn.com
- Bug Reporting: Submit functional bugs via the Z-Blog Forum or directly through GitHub Issues.
- Contributions: Pull Requests are welcome.
Embed templates and modules in Z-BlogPHP
masterYou can include other template files or modules within your current template using specific tag syntax. This allows for modular design and reusable components.
{template:TEMPLATE_NAME} {module:MODULE_NAME}System requirements for Z-BlogPHP
masterBefore installing Z-BlogPHP, ensure your server meets the following environment requirements:
Web Server
Supports various web servers including:
- IIS
- Apache
- nginx
- Lighttpd
- Kangle
- Tengine
- Caddy
PHP Version
- PHP 5.2 through 8.4
- HHVM 3
Database Support
- MySQL 5+
- MariaDB 10+
- SQLite 3
- PostgreSQL