Simple blog implementation with a router
Initially based on cockpit-docs/tutorials/simple_blog.md
- Download and extract: https://github.com/raruto/cockpit-blog/archive/master.zip
- Move it to your localhost server and open: http://localhost/cockpit-blog/install
- Your website is now available at: http://localhost/cockpit-blog
Public stuffs are located at project web root (_site
, css
, js
and media
folders).
-
Theme: php template files are located in the
_theme/views
folder. -
Assets: static theme files are located at project web root (
css
,js
,media
folders). -
Router: public site routes are defined in the root
index.php
file. -
Images: uploaded images are located in the
media/uploads
folder. -
Database: files are located in the
_site/data
folder. -
Addons: cockpit addons can be placed in the
_site/addons
oradmin/addons
folders (according to your needs). -
Config: common configuration files are located in the
_site/config
folder, default constants are overridable in through the_site/defines.php
file. -
Cockpit: core files are located within the
admin
folder, you can rename it to something less "common" (without pain), but you shouldn't edit any other files inside that folder (unless you know what you're doing).
Open a shell at project web root and run: php -S localhost:8080 index.php
for starting the built-in development server.
The following components are shipped by the CMS:
- MongoDB query language
- UIKit + Riot.js components
- TinyMCE + Markdown editor
- Lime php micro-framework
- Lexy templating engine
- Rest API endpoints
- PHPMailer forms
Note: although cockpit take advantage of the "MongoDB" query language, it doesn't really need a MongoDB server to operate and, unless configured otherwise, it stores all information as json documents within the built-in SQLite database located in the cockpit/storage/data
folder (see: MongoHybrid, MongoLite and bootstrap.php for further information). Check out the cockpit-sql-driver integration if you are planning to use a MySQL, MariaDB or PostgreSQL server instance.
The following classes are part of the cockpit core:
Note: take a look at the following SQL to MongoDB comparison to fully understand the difference between "collections" and "tables"
The following plugins are bundled in this repository:
- Autosave
- BetterSlugs
- ExtendedForms
- ExtendedLime
- ExtendedUI
- Honeypot
- ImageOptimizer
- MaintenanceMode
- Matomo
- NativeLazyLoading
- PWA
- RSSFeed
- SampleAddon
- SampleData
- SVGFavicon
- XMLSitemaps
- Snippets
Note: take a look at the Cockpit-Helpers and Cockpit-Scripts repositories to find out some other useful code samples on how to build your own addons (see also: list-of-cockpit-addons).
Download and copy appropriate language files from:
- cockpit-i18n to
/cockpit/config/cockpit/i18n
- tinymce-i18n to
/cockpit/storage/assets/cockpit/i18n/tinymce
After that you will be able to change the language of Cockpit from the accounts
panel (admin dashboard).
Note: check out the i18n
and languages
directives if you wish to set a default language for all users (see: zeraton-docs to understand how to edit cockpit config
files)
Backup your admin/defines.php
file and replace the admin
folder with your cockpit-next release.
Useful links
Implementation notes
Already Implemented:
- Semantic Elements
- Native Lazy Loading
- SVG Favicons
- Sitemap XML
- RSS feed
- JSON feed
- Robots.txt
- Manifest.json
- Open Graph
- Twitter cards
- Schema.org
- Matomo Tracking
- Offline caching (PWA - Service Worker)
- Posts Pagination
- Installer Script
- Privacy and Cookie
- Contact form
- Search form
Next Steps:
- Multilingualism (eg. through a catch-all route:
$app->run('/*')
)
Special thanks to: Artur Heinze, Paulo Gomes and Raffael Jesche
Related projects: Copilot, Monoplane, CpMultiplane