Fork 4 Developers

Post on 15-Jan-2015

1.204 views 1 download

description

Over de code, structuur en API's van Fork CMS. Vooral gericht naar developers.

Transcript of Fork 4 Developers

Fork CMSDevelopers!

hashtag: #forkmeetupwifi: VergaderNet, wachtwoord:

ventilatie

I’m Dieter @dieterve

This is Davy @bauffman

In depth

‣ Applications‣ Backend‣ Frontend‣ API‣ Modules

Content

‣ Applications‣ Backend‣ Frontend‣ API‣ Modules

Content

‣ Applications‣ Backend‣ Frontend‣ API‣ Modules

Content

‣ Applications‣ Backend‣ Frontend‣ API‣ Modules

Content

‣ Applications‣ Backend‣ Frontend‣ API‣ Modules

Content

applications - backend - frontend - api - modules

Frontend Backend API

Library

‣ 1 for each purpose‣ Clean separation between apps‣ Possible overlap (causing overhead)

Applications

applications - backend - frontend - api - modules

‣ Core‣ Modules (some required)‣ Based on MVC‣ Limited template logic

Structure

applications - backend - frontend - api - modules

‣ Routing‣ Templates‣ Authentication‣ Forms‣ ...

Core

applications - backend - frontend - api - modules

Modules

applications - backend - frontend - api - modules

actionsajaxcronjobs (backend only)engineinstaller (backend only)jslayout

templateswidgets

widgets

‣ Global configuration‣ External classes‣ Google analytics‣ Facebook‣ Akismet

‣ Spoon Library

Library

applications - backend - frontend - api - modules

‣ PHP5 library‣ Basic components‣ UTF-8 support‣ Unit tested‣ Open source (github)

Spoon Library

applications - backend - frontend - api - modules

‣ SPOON_DEBUG true / false‣ Exceptions‣ PHP errors / warnings / ...

Error handling

applications - backend - frontend - api - modules

applications - backend - frontend - api - modules

‣ Content management‣ Authentication‣ Only logged in users

‣ Module driven‣ Semi clean url’s (GET)

Backend

applications - backend - frontend - api - modules

‣ Router‣ Loads module based on URL‣ http://<site>/private/en/module/

controller?param=value‣ Authentication‣ Action level

Core

applications - backend - frontend - api - modules

‣ Basic layout‣ Datagrids‣ Forms‣ Tabs‣ Filters

Core

applications - backend - frontend - api - modules

applications - backend - frontend - api - modules

applications - backend - frontend - api - modules

‣ Base for actions‣ Less monkey jobs‣ Success/error reporting‣ Autoloading js/css‣ Choosing template‣ ...

Base classes

applications - backend - frontend - api - modules

Reporting

applications - backend - frontend - api - modules

‣ <module>.js‣ <action>.js‣ <action>.css

Autoloading JS / CSS

applications - backend - frontend - api - modules

‣ index / add / edit‣ BackendBaseActionAdd‣ create and display form

‣ BackendBaseActionIndex‣ create and display datagrid

‣ All you have to do is add data

Specific base classes

applications - backend - frontend - api - modules

‣ Per module (by installer)‣ Flexible‣ Not limited to module context‣ settings

Backend navigation

applications - backend - frontend - api - modules

‣ BackendAnalyticsContent‣ BackendAnalyticsModel‣ BackendAnalyticsHelper

Autoloader

applications - backend - frontend - api - modules

Directory structure

applications - backend - frontend - api - modules

actionsajaxcronjobsengineinstallerjslayout

templateswidgets

widgets

‣ Controller‣ Interface for the user‣ Index / add / edit / delete / ...‣ Extends from base class(es)‣ Navigation links to action

Action

applications - backend - frontend - api - modules

‣ View‣ Action template‣ <action>.tpl‣ SpoonTemplate syntax

Layout / template

applications - backend - frontend - api - modules

‣ Model‣ Class with static methods‣ Handles database interaction

‣ Helper‣ Can be anything

Engine

applications - backend - frontend - api - modules

‣ Controller‣ Own base class‣ Authentication‣ Json output

Ajax

applications - backend - frontend - api - modules

‣ Controller‣ Own base class‣ No authentication‣ Collisions‣ Command line or HTTP

Cronjob

applications - backend - frontend - api - modules

‣ Set rights‣ Set navigation structure‣ Set extra’s (create pages, ...)‣ install.sql‣ locale.xml

Installer

applications - backend - frontend - api - modules

‣ The website‣ Visitors‣ Guests‣ Registered visitors

‣ Page driven (http://<site>/page)

Frontend

applications - backend - frontend - api - modules

‣ 2 types of controllers‣ Action: 1 per page (route dependant)‣ Widget: * per page

‣ Defined in pages module‣ All about pages

Frontend

applications - backend - frontend - api - modules

‣ 1 page = 1 template‣ 1 template = * blocks‣ Block‣ Action‣ Widget

Pages

applications - backend - frontend - api - modules

Blocks in de template...

1

2

3

4 5

6

7

applications - backend - frontend - api - modules

Pages

‣ Routing‣ action to execute‣ widget(s) to execute‣ based on the current page

Core

applications - backend - frontend - api - modules

‣ SPOON_DEBUG = false‣ minified.css‣ Custom js / css = auto

Minify

applications - backend - frontend - api - modules

‣ XML‣ JSON‣ Authentication possible‣ /api/1.0/?

method=<module>.<function>&param=value..

API

applications - backend - frontend - api - modules

‣ BackendBlogAPI‣ Public functions‣ Parameter validation

API

applications - backend - frontend - api - modules

‣ Index pool‣ Fields defined per module‣ Callback per module

Search

applications - backend - frontend - api - modules

Add to index

applications - backend - frontend - api - modules

Callback

applications - backend - frontend - api - modules

‣ Create textbox

‣ Save after validation

Tags

applications - backend - frontend - api - modules

Tags

applications - backend - frontend - api - modules

Tags

applications - backend - frontend - api - modules

‣ Again 1 pool‣ SEO‣ Almost every module needs it

Meta

applications - backend - frontend - api - modules

applications - backend - frontend - api - modules

applications - backend - frontend - api - modules

‣ Create formMeta

applications - backend - frontend - api - modules

‣ Validate

‣ Save

‣ Multi language‣ Maintainable by backend user‣ Split between applications

Locale

applications - backend - frontend - api - modules

‣ Split between modules‣ Fallback to core

Locale - backend

applications - backend - frontend - api - modules

‣ 1 pool

Locale - frontend

applications - backend - frontend - api - modules

Questions?