Quickstart
Introduction to Lecker CMS
Table of Contents
- Project Structure
- Core Components
- Lecker CMS UI
- Important Tables and Terms
- Libraries
- Modules
- Security Best Practices
Project Structure
The Lecker project follows a specific file structure:
application/
config/
- Database connection, base URL, constants, routes, autoload, etc.controllers/
- Main project functions for frontend, backend, content management, etc.core/
- Contains MY_Controller with shared functionshelpers/
- Contains besc_helper for simple helper functionslanguage/
- Contains language lines accessed via$this->lang->line('your_line_key')
libraries/
- Project libraries and Lecker_crudmodels/
- Models named by the controller where they are usedviews/
- HTML views for frontend, mail, authentication etc.
assets/
- Fixed assets shared between projectssystem/
- Core CodeIgniter libraries and PHP files, including Model.phpitems/
- Project-specific assets (JavaScript, CSS, images, uploads)vendor/
- Composer and third-party librariescomposer.json
&composer.lock
- List of installed librariesindex.php
- Application entry point (switch to production environment for live sites).htaccess
Core Components
Controllers
-
Backend & Repository Controller
- Basic backend functions
- Repository management (overviews, teaser image selectors)
-
Content Controller
- Setup of editable tables in CMS
- Content Helper for displaying buttons and data
- Module saving, cloning, and display
- Error logging
-
Authentication & User Controller
- Backend and frontend login
- Password reset
-
Frontend Controller
- Public-facing views
- Data preparation
-
Lecker Controller
- Core of the CRUD system
- Functions for rendering tables, editing, filtering, and image upload
-
MY_Controller
- Universal functions used throughout the app
- Image preparation for modules
- Naming functions
- Error logging functions
Models
Models specify database queries for CRUD operations using CodeIgniter syntax. The Model.php
in the system folder defines universal model functions that can be used anywhere.
Lecker CMS UI
The Content Management System is accessible via the Backend at /backend
(default setting editable in routes.php). Key features include:
- Dashboard with editable tables
- Menu divided into groups:
- Normal project user: Content, General, Repositories
- Projects with shop: additional Shop category
- Developers: additional Dev Area category
- Settings for user data and dashboard customization
Login requires a backend_user with admin set to 1 to access and edit tables.
Important Tables and Terms
-
Entity
- Middle point to connect with teaser images and items
- First image taken as main, can be reordered
- Define table columns and relationships
- Uses entity_teaser_relation
- Types:
- Article Entity: represented by a page with dynamic modules
- Noarticle Entity: exist independently, without articles or modules
- Must be specified in constants for ID generation
-
Article (table items)
- Subordinate to Entity
- Contains modules and language-specific content
- Defined via pretty URL
- Four visibility options:
- Visible
- Only with direct link
- Logged in only
- Hidden
- Can be associated with multiple modules (text, image, gallery)
- Supports multiple languages (specify in constants)
- Can link original article with secondary language articles
-
Image Repository
- Central storage for images and photos
- Connect to entities as teaser images, modules, or noarticle entities
- Public/private settings (private images blurred in backend)
- Resized and saved by default in three versions using Imagick library:
- Frontend image
- Full size
- Thumbnail
-
Tags
- General (associated with any Article Entity)
- Specific to certain Noarticle or Article entity types
- Default tag connected with Normal Article entity
-
File Repository
- For saving various file types (mainly smaller PDF files or ZIP packages)
- Used in articles via download module
-
User Table
- Accessible only to superadmin
- For creating and managing user accounts and permissions
-
Dev Area
- Not visible for non-dev backend users
- Contains error logs, article overview, debugging tables, and stats
- Automatic error logging using MY_Controller functions
Libraries
Lecker includes several libraries:
- PDF creator
- Shopping functions
- Picture creation
- CKEditor for text editing
- PHPMailer
Modules
Modules for articles are specified in three main areas:
-
Content Controller
- Types of modules and their columns
-
crud.php
- Preview of modules in backend
- Module editor
- Icons
-
Frontend Controller
- Detail function to collect article-specific modules and content
-
JavaScript files
- edit.js in items/backend
- Module-specific JavaScript files
- Specifies transfer of information between module editor and preview
Security Best Practices
- Keep the CMS and plugins up to date
- Implement basic security measures
- Use secrets management:
- Create a
.env
file in the root directory - see template under installation - Access secrets using
$_ENV['SECRET_NAME']
- Use phpdotenv library
- Create a