SlideShare a Scribd company logo
Unleashing Creative
Freedom with
What is your current
platform of choice?
Who am I?
Mark Hamstra
Founder & CEA at modmore
Freelance MODX Developer
my doggies
Turbo
Bommel
Agenda
• What is MODX, for whom, available
features, how to build a MODX site
• Tour of the MODX Manager (back-end)
• The Architecture of MODX, xPDO ORM,
extending and overriding
MOD-what?
• Open Source
• Written in PHP (of course)
• Primarily used with MySQL, other drivers available
• Already 10 years old young
• Content Management System Framework Platform
https://twitpic.com/3pvrmw
For who is MODX
• Web Professionals
• Designers
• Front-end developers
• Using MODX as a tool
• Est 4-5.000.000 sites
Community
• Professional and helpful
• Official Forum: forums.modx.com 50.544
• +- 1M views of modx.com per month
• Twitter: #MODX
• Slack: modx.org 286
All the features of a CMS
rich text editor versioning user groups
multisite templates multilingual extensions
markdown media browser hierarchical
page tree commercial support automatic
menu builder blogging permissions seo
friendly urls server-side caching
Installs without Assumptions
Elements as Building Blocks
Templates
TemplateVariables
Chunks
Snippets
Plugins
Templates
• Usually HTML
• Contains MODX tags
• One template per page
Template Variables
• Custom field for resources
• Commonly “TV”
• Tied to templates
• Text, image, select, checkbox,
date, radio, richtext, tag and
custom types available
• [[*name-of-tv]]
Chunks
• Usually HTML
• Reusable piece of code
• [[$name-of-chunk]]
Template
Chunk “head”
Snippets
• PHP!
• Comparable to a function
• Accepts properties
• [[name-of-snippet]] or 

[[!name-of-snippet]]
Snippet “helloWorld”
Template
Snippets
But wait, there’s more!
• [[name-of-snippet]]
• [[!name-of-snippet]]
• = uncached!
• [[++name-of-setting]]

[[!++name-of-setting]]
• [[$name-of-chunk]]

[[!$name-of-chunk]]
• [[*name-of-field]]

[[!*name-of-field]]
But wait, there’s even more!
• [[helloWorld?

&property=`value`

]]
• [[$head?

&extraCss=`<link rel=.. href=..>`

]]
Plugins
• PHP!
• Event-based, so no tags
• Can read and often
influence behaviour
No need to reinvent

the wheel
• Packages (aka extras, add-
ons, extensions, third party
components…) provide
common functionality
• Install via Package Installer
inside the manager
Example: getResources
• Lists resources matching
conditions
• Uses a Chunk as template
• Use Cases:
• Article listings
• Dynamic (sub)menus
• RSS feed generation
Template
Chunk “blogListItem”
Time for a Manager Tour!
http://localhost/tmp/phpfrl/manager/
MODX Architecture
Secure by Design
• Automatic $_GET, $_POST, $_REQUEST
sanitisation in the request handler
• xPDO ORM prevents SQL Injections
• 28 CVE entries, 8 since 2014
• WordPress: 906, already ~85 in 2015
• Drupal: 915, already ~120 in 2015
2015-07, cve.mitre.org
xPDO
• Object Relational Bridge / ORM
• Open Source (modxcms/xpdo)
• Extension to PHP’s PDO
• Support for MySQL, sqlsrv (and more)
Fetching a Single Object
$obj = $modx->getObject(‘modChunk’, 5);
$c = array(‘name’ => ‘head’);
$obj = $modx->getObject(‘modChunk’, $c)
Easy Query Builder
$c = $modx->newQuery(‘modResource’);
$c->where([
‘parent’ => 0,
‘AND:pagetitle:LIKE => ‘%About%’
]);
$matches = $modx->getCollection(‘modResource’, $c);
foreach ($matches as $modResource) { . . . }
Automatic Filtering
$search = $_POST[‘search’];
$c = $modx->newQuery(‘modResource’);
$c->where([
‘introtext:LIKE’ => “%{$search}%”,
]);
$modx->setPlaceholder(‘search’, sanitise($search));
function sanitise($value) { return htmlentities($value, ENT_QUOTES,
‘UTF-8’); }
👍
⚠
Custom Models with xPDO
1. Create an xPDO Package Schema (XML)
2. Use build script to write schema into the actual
model files/classes
3. Register it before use ($modx->addPackage)
4. Use any xPDO method (getObject,
getCollection) on your custom model
xPDO Package Schema - Head
<?xml version="1.0" encoding="UTF-8"?>
<model package="phpfrl"
baseClass="xPDOSimpleObject"
platform="mysql"
defaultEngine="MyISAM"
version="1.1">
xPDO Package Schema - Object
<?xml version="1.0" encoding="UTF-8"?>
<model package=“phpfrl” …
<object class="frlMeetup" table=“meetups”>
.. fields ..
</object>
<object class="frlSpeaker" table=“speakers”> … </object>
</model>
xPDO Package Schema - Fields
<?xml version="1.0" encoding="UTF-8"?>
<model package=“phpfrl” …
<object class="frlMeetup" table=“meetups">
<field 

key="name" 

dbtype="varchar" 

precision="100" 

phptype="string" 

null="false" 

default=“PHP FRL Meetup" />
xPDO Package Schema - Indices
<?xml version="1.0" encoding="UTF-8"?>
<model package=“phpfrl” …
<object class="frlMeetup" table=“meetups">

<field key="name" dbtype=“varchar" …

<field key=“starts_on" dbtype=“datetime"

<field key="name" dbtype=“varchar" …
<index alias="name" name="name" primary="false"
unique="false" type="BTREE">

<column key="name" length="" collation="A" null="false" />

</index>

</object>
xPDO Package Schema - Relations
<?xml version="1.0" encoding="UTF-8"?>
<model package=“phpfrl” baseClass=“xPDOSimpleObject" …
<object class="frlMeetup" table=“meetups">

<field key="name" dbtype=“varchar” …>
<composite alias=“Speakers” class=“frlSpeaker” local=“id” foreign=“meetup”
cardinality=“many” owner=“local” />

</object>
<object class="frlSpeaker" table=“speakers">

<field key="name" dbtype=“varchar” …>

<field key="meetup" dbtype=“int” …>
<aggregate alias=“Meetup” class=“frlMeetup” local=“meetup” foreign=“id”
cardinality=“one” owner=“foreign” />

</object>
xPDO Generated Model
<?php

class frlMeetup extends xPDOSimpleObject {
}
Interacting with that model
$modx->addPackage(‘phpfrl’, ‘/path/to/model/‘);
$c = $modx->newQuery(‘frlMeetup’);

$c->sortby(‘starts_on’, ‘DESC’);

$meetup = $modx->getObject(‘frlMeetup’, $c);
echo ‘De volgende meetup is ‘ . $meetup->name . ‘ en vind plaats op ‘ . $meetup-
>starts_on . ‘. ’;
$speakers = $meetup->getMany(‘Speakers’); // or just $meetup->Speakers

foreach ($speakers as $spegfytaker) {

echo $speaker->name . ‘ zal vertellen over ‘ . $speaker->subject;

}
Interesting links:
• MODX.com => official website
• rtfm.modx.com => official documentation
• github.com/modxcms/revolution => source code
• MODX.today => daily links/articles about MODX
• modmore.com => premium extras for MODX
• https://joind.in/talk/view/15031 => please leave feedback
Enjoy your Creative Freedom

More Related Content

What's hot

What's up with Drupal 7?
What's up with Drupal 7?What's up with Drupal 7?
What's up with Drupal 7?
Gábor Hojtsy
 
Doing Drupal security right from Drupalcon London
Doing Drupal security right from Drupalcon LondonDoing Drupal security right from Drupalcon London
Doing Drupal security right from Drupalcon London
Gábor Hojtsy
 
Drupal Security from Drupalcamp Cologne 2009
Drupal Security from Drupalcamp Cologne 2009Drupal Security from Drupalcamp Cologne 2009
Drupal Security from Drupalcamp Cologne 2009
Gábor Hojtsy
 
Drupal 7 Theme System
Drupal 7 Theme SystemDrupal 7 Theme System
Drupal 7 Theme System
Peter Arato
 
itPage LDC 09 Presentation
itPage LDC 09 PresentationitPage LDC 09 Presentation
itPage LDC 09 Presentation
Eric Landmann
 
Introduction to Drupal (7) Theming
Introduction to Drupal (7) ThemingIntroduction to Drupal (7) Theming
Introduction to Drupal (7) Theming
Robert Carr
 
You Got React.js in My PHP
You Got React.js in My PHPYou Got React.js in My PHP
You Got React.js in My PHP
Taylor Lovett
 
A look at Drupal 7 Theming
A look at Drupal 7 ThemingA look at Drupal 7 Theming
A look at Drupal 7 Theming
Aimee Maree Forsstrom
 
Transforming WordPress Search and Query Performance with Elasticsearch
Transforming WordPress Search and Query Performance with Elasticsearch Transforming WordPress Search and Query Performance with Elasticsearch
Transforming WordPress Search and Query Performance with Elasticsearch
Taylor Lovett
 
Php converted pdf
Php converted pdfPhp converted pdf
Php converted pdf
Northpole Web Service
 
Ppt php
Ppt phpPpt php
How to start developing apps for Firefox OS
How to start developing apps for Firefox OSHow to start developing apps for Firefox OS
How to start developing apps for Firefox OS
benko
 
Module development
Module developmentModule development
Module development
ingraminnovation
 
Modernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with ElasticsearchModernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with Elasticsearch
Taylor Lovett
 
Drupal theming - a practical approach (European Drupal Days 2015)
Drupal theming - a practical approach (European Drupal Days 2015)Drupal theming - a practical approach (European Drupal Days 2015)
Drupal theming - a practical approach (European Drupal Days 2015)
Eugenio Minardi
 
Php with mysql ppt
Php with mysql pptPhp with mysql ppt
Php with mysql ppt
Rajamanickam Gomathijayam
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPress
Taylor Lovett
 
20110606 e z_flow_gig_v1
20110606 e z_flow_gig_v120110606 e z_flow_gig_v1
20110606 e z_flow_gig_v1
Gilles Guirand
 
Drupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case StudyDrupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case Study
hernanibf
 

What's hot (19)

What's up with Drupal 7?
What's up with Drupal 7?What's up with Drupal 7?
What's up with Drupal 7?
 
Doing Drupal security right from Drupalcon London
Doing Drupal security right from Drupalcon LondonDoing Drupal security right from Drupalcon London
Doing Drupal security right from Drupalcon London
 
Drupal Security from Drupalcamp Cologne 2009
Drupal Security from Drupalcamp Cologne 2009Drupal Security from Drupalcamp Cologne 2009
Drupal Security from Drupalcamp Cologne 2009
 
Drupal 7 Theme System
Drupal 7 Theme SystemDrupal 7 Theme System
Drupal 7 Theme System
 
itPage LDC 09 Presentation
itPage LDC 09 PresentationitPage LDC 09 Presentation
itPage LDC 09 Presentation
 
Introduction to Drupal (7) Theming
Introduction to Drupal (7) ThemingIntroduction to Drupal (7) Theming
Introduction to Drupal (7) Theming
 
You Got React.js in My PHP
You Got React.js in My PHPYou Got React.js in My PHP
You Got React.js in My PHP
 
A look at Drupal 7 Theming
A look at Drupal 7 ThemingA look at Drupal 7 Theming
A look at Drupal 7 Theming
 
Transforming WordPress Search and Query Performance with Elasticsearch
Transforming WordPress Search and Query Performance with Elasticsearch Transforming WordPress Search and Query Performance with Elasticsearch
Transforming WordPress Search and Query Performance with Elasticsearch
 
Php converted pdf
Php converted pdfPhp converted pdf
Php converted pdf
 
Ppt php
Ppt phpPpt php
Ppt php
 
How to start developing apps for Firefox OS
How to start developing apps for Firefox OSHow to start developing apps for Firefox OS
How to start developing apps for Firefox OS
 
Module development
Module developmentModule development
Module development
 
Modernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with ElasticsearchModernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with Elasticsearch
 
Drupal theming - a practical approach (European Drupal Days 2015)
Drupal theming - a practical approach (European Drupal Days 2015)Drupal theming - a practical approach (European Drupal Days 2015)
Drupal theming - a practical approach (European Drupal Days 2015)
 
Php with mysql ppt
Php with mysql pptPhp with mysql ppt
Php with mysql ppt
 
JSON REST API for WordPress
JSON REST API for WordPressJSON REST API for WordPress
JSON REST API for WordPress
 
20110606 e z_flow_gig_v1
20110606 e z_flow_gig_v120110606 e z_flow_gig_v1
20110606 e z_flow_gig_v1
 
Drupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case StudyDrupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case Study
 

Viewers also liked

Hello meet MODx Revolution
Hello meet MODx RevolutionHello meet MODx Revolution
Hello meet MODx Revolution
MODxpo
 
Psd to modx conversion for setting up powerful websites quickly
Psd to modx conversion for setting up powerful websites quicklyPsd to modx conversion for setting up powerful websites quickly
Psd to modx conversion for setting up powerful websites quickly
john Jha
 
Solving the Workflow (or, how MODX.today is being built with git and Gitify)
Solving the Workflow (or, how MODX.today is being built with git and Gitify)Solving the Workflow (or, how MODX.today is being built with git and Gitify)
Solving the Workflow (or, how MODX.today is being built with git and Gitify)
Mark Hamstra
 
MODx evolution documentation
MODx evolution documentationMODx evolution documentation
MODx evolution documentation
krava77
 
Dev, Staging & Production Workflow with Gitify (at MODXpo 2015 in Munich)
Dev, Staging & Production Workflow with Gitify (at MODXpo 2015 in Munich)Dev, Staging & Production Workflow with Gitify (at MODXpo 2015 in Munich)
Dev, Staging & Production Workflow with Gitify (at MODXpo 2015 in Munich)
Mark Hamstra
 
MODXで超キレッキレのブログ作る秘訣公開します りたーんず!!!
MODXで超キレッキレのブログ作る秘訣公開します りたーんず!!!MODXで超キレッキレのブログ作る秘訣公開します りたーんず!!!
MODXで超キレッキレのブログ作る秘訣公開します りたーんず!!!
Kei Mikage
 

Viewers also liked (6)

Hello meet MODx Revolution
Hello meet MODx RevolutionHello meet MODx Revolution
Hello meet MODx Revolution
 
Psd to modx conversion for setting up powerful websites quickly
Psd to modx conversion for setting up powerful websites quicklyPsd to modx conversion for setting up powerful websites quickly
Psd to modx conversion for setting up powerful websites quickly
 
Solving the Workflow (or, how MODX.today is being built with git and Gitify)
Solving the Workflow (or, how MODX.today is being built with git and Gitify)Solving the Workflow (or, how MODX.today is being built with git and Gitify)
Solving the Workflow (or, how MODX.today is being built with git and Gitify)
 
MODx evolution documentation
MODx evolution documentationMODx evolution documentation
MODx evolution documentation
 
Dev, Staging & Production Workflow with Gitify (at MODXpo 2015 in Munich)
Dev, Staging & Production Workflow with Gitify (at MODXpo 2015 in Munich)Dev, Staging & Production Workflow with Gitify (at MODXpo 2015 in Munich)
Dev, Staging & Production Workflow with Gitify (at MODXpo 2015 in Munich)
 
MODXで超キレッキレのブログ作る秘訣公開します りたーんず!!!
MODXで超キレッキレのブログ作る秘訣公開します りたーんず!!!MODXで超キレッキレのブログ作る秘訣公開します りたーんず!!!
MODXで超キレッキレのブログ作る秘訣公開します りたーんず!!!
 

Similar to Unleashing Creative Freedom with MODX (2015-09-03 at GroningenPHP)

Introduction To Drupal
Introduction To DrupalIntroduction To Drupal
Introduction To Drupal
Lauren Roth
 
An Introduction to Tornado
An Introduction to TornadoAn Introduction to Tornado
An Introduction to Tornado
Gavin Roy
 
GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App Engine
Yared Ayalew
 
Creating Custom Templates for Joomla! 2.5
Creating Custom Templates for Joomla! 2.5Creating Custom Templates for Joomla! 2.5
Creating Custom Templates for Joomla! 2.5
Don Cranford
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
Joram Salinas
 
Php reports sumit
Php reports sumitPhp reports sumit
Php reports sumit
Sumit Biswas
 
CCI2018 - Automatizzare la creazione di risorse con ARM template e PowerShell
CCI2018 - Automatizzare la creazione di risorse con ARM template e PowerShellCCI2018 - Automatizzare la creazione di risorse con ARM template e PowerShell
CCI2018 - Automatizzare la creazione di risorse con ARM template e PowerShell
walk2talk srl
 
ITPROceed 2016 - The Art of PowerShell Toolmaking
ITPROceed 2016 - The Art of PowerShell ToolmakingITPROceed 2016 - The Art of PowerShell Toolmaking
ITPROceed 2016 - The Art of PowerShell Toolmaking
Kurt Roggen [BE]
 
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Lucidworks
 
Php intro
Php introPhp intro
Php intro
Jennie Gajjar
 
Php intro
Php introPhp intro
Php intro
Jennie Gajjar
 
Php intro
Php introPhp intro
Php intro
Jennie Gajjar
 
Drupal 8 - Core and API Changes
Drupal 8 - Core and API ChangesDrupal 8 - Core and API Changes
Drupal 8 - Core and API Changes
Shabir Ahmad
 
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Anupam Ranku
 
ITB2017 - Keynote
ITB2017 - KeynoteITB2017 - Keynote
ITB2017 - Keynote
Ortus Solutions, Corp
 
Gajendra sharma Drupal Module development
Gajendra sharma Drupal Module developmentGajendra sharma Drupal Module development
Gajendra sharma Drupal Module development
Gajendra Sharma
 
Extending eZ Platform v2 with Symfony and React
Extending eZ Platform v2 with Symfony and ReactExtending eZ Platform v2 with Symfony and React
Extending eZ Platform v2 with Symfony and React
eZ Systems
 
Ipc mysql php
Ipc mysql php Ipc mysql php
Ipc mysql php
Anis Berejeb
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
Oscar Merida
 
Introduction to Monsoon PHP framework
Introduction to Monsoon PHP frameworkIntroduction to Monsoon PHP framework
Introduction to Monsoon PHP framework
Krishna Srikanth Manda
 

Similar to Unleashing Creative Freedom with MODX (2015-09-03 at GroningenPHP) (20)

Introduction To Drupal
Introduction To DrupalIntroduction To Drupal
Introduction To Drupal
 
An Introduction to Tornado
An Introduction to TornadoAn Introduction to Tornado
An Introduction to Tornado
 
GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App Engine
 
Creating Custom Templates for Joomla! 2.5
Creating Custom Templates for Joomla! 2.5Creating Custom Templates for Joomla! 2.5
Creating Custom Templates for Joomla! 2.5
 
Codeigniter
CodeigniterCodeigniter
Codeigniter
 
Php reports sumit
Php reports sumitPhp reports sumit
Php reports sumit
 
CCI2018 - Automatizzare la creazione di risorse con ARM template e PowerShell
CCI2018 - Automatizzare la creazione di risorse con ARM template e PowerShellCCI2018 - Automatizzare la creazione di risorse con ARM template e PowerShell
CCI2018 - Automatizzare la creazione di risorse con ARM template e PowerShell
 
ITPROceed 2016 - The Art of PowerShell Toolmaking
ITPROceed 2016 - The Art of PowerShell ToolmakingITPROceed 2016 - The Art of PowerShell Toolmaking
ITPROceed 2016 - The Art of PowerShell Toolmaking
 
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
 
Php intro
Php introPhp intro
Php intro
 
Php intro
Php introPhp intro
Php intro
 
Php intro
Php introPhp intro
Php intro
 
Drupal 8 - Core and API Changes
Drupal 8 - Core and API ChangesDrupal 8 - Core and API Changes
Drupal 8 - Core and API Changes
 
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
Office 365 Saturday (Sydney) - SharePoint framework – build integrated user e...
 
ITB2017 - Keynote
ITB2017 - KeynoteITB2017 - Keynote
ITB2017 - Keynote
 
Gajendra sharma Drupal Module development
Gajendra sharma Drupal Module developmentGajendra sharma Drupal Module development
Gajendra sharma Drupal Module development
 
Extending eZ Platform v2 with Symfony and React
Extending eZ Platform v2 with Symfony and ReactExtending eZ Platform v2 with Symfony and React
Extending eZ Platform v2 with Symfony and React
 
Ipc mysql php
Ipc mysql php Ipc mysql php
Ipc mysql php
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
 
Introduction to Monsoon PHP framework
Introduction to Monsoon PHP frameworkIntroduction to Monsoon PHP framework
Introduction to Monsoon PHP framework
 

More from Mark Hamstra

The (Long) Road to Commerce 1.0
The (Long) Road to Commerce 1.0The (Long) Road to Commerce 1.0
The (Long) Road to Commerce 1.0
Mark Hamstra
 
Improving the MODX Documentation - March 29, 2019
Improving the MODX Documentation - March 29, 2019Improving the MODX Documentation - March 29, 2019
Improving the MODX Documentation - March 29, 2019
Mark Hamstra
 
Commerce in 30 minutes (November 15, 2018 at MODX Meetup Maastricht)
Commerce in 30 minutes (November 15, 2018 at MODX Meetup Maastricht)Commerce in 30 minutes (November 15, 2018 at MODX Meetup Maastricht)
Commerce in 30 minutes (November 15, 2018 at MODX Meetup Maastricht)
Mark Hamstra
 
MODX Meetup 2018-03-07 - Introduction talk
MODX Meetup 2018-03-07 - Introduction talk MODX Meetup 2018-03-07 - Introduction talk
MODX Meetup 2018-03-07 - Introduction talk
Mark Hamstra
 
Solving the Workflow - Building MODX.today with Gitify (2015-05-21, Alkmaar)
Solving the Workflow - Building MODX.today with Gitify (2015-05-21, Alkmaar)Solving the Workflow - Building MODX.today with Gitify (2015-05-21, Alkmaar)
Solving the Workflow - Building MODX.today with Gitify (2015-05-21, Alkmaar)
Mark Hamstra
 
MODX Weekend 2014 - Welcome Slides
MODX Weekend 2014 - Welcome SlidesMODX Weekend 2014 - Welcome Slides
MODX Weekend 2014 - Welcome Slides
Mark Hamstra
 
MODXpo 2013 - The Business of Premium - Day 2, 14:30
MODXpo 2013 - The Business of Premium - Day 2, 14:30MODXpo 2013 - The Business of Premium - Day 2, 14:30
MODXpo 2013 - The Business of Premium - Day 2, 14:30
Mark Hamstra
 

More from Mark Hamstra (7)

The (Long) Road to Commerce 1.0
The (Long) Road to Commerce 1.0The (Long) Road to Commerce 1.0
The (Long) Road to Commerce 1.0
 
Improving the MODX Documentation - March 29, 2019
Improving the MODX Documentation - March 29, 2019Improving the MODX Documentation - March 29, 2019
Improving the MODX Documentation - March 29, 2019
 
Commerce in 30 minutes (November 15, 2018 at MODX Meetup Maastricht)
Commerce in 30 minutes (November 15, 2018 at MODX Meetup Maastricht)Commerce in 30 minutes (November 15, 2018 at MODX Meetup Maastricht)
Commerce in 30 minutes (November 15, 2018 at MODX Meetup Maastricht)
 
MODX Meetup 2018-03-07 - Introduction talk
MODX Meetup 2018-03-07 - Introduction talk MODX Meetup 2018-03-07 - Introduction talk
MODX Meetup 2018-03-07 - Introduction talk
 
Solving the Workflow - Building MODX.today with Gitify (2015-05-21, Alkmaar)
Solving the Workflow - Building MODX.today with Gitify (2015-05-21, Alkmaar)Solving the Workflow - Building MODX.today with Gitify (2015-05-21, Alkmaar)
Solving the Workflow - Building MODX.today with Gitify (2015-05-21, Alkmaar)
 
MODX Weekend 2014 - Welcome Slides
MODX Weekend 2014 - Welcome SlidesMODX Weekend 2014 - Welcome Slides
MODX Weekend 2014 - Welcome Slides
 
MODXpo 2013 - The Business of Premium - Day 2, 14:30
MODXpo 2013 - The Business of Premium - Day 2, 14:30MODXpo 2013 - The Business of Premium - Day 2, 14:30
MODXpo 2013 - The Business of Premium - Day 2, 14:30
 

Recently uploaded

Design Thinking NETFLIX using all techniques.pptx
Design Thinking NETFLIX using all techniques.pptxDesign Thinking NETFLIX using all techniques.pptx
Design Thinking NETFLIX using all techniques.pptx
saathvikreddy2003
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
uehowe
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
cuobya
 
Discover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to IndiaDiscover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to India
davidjhones387
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
fovkoyb
 
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
zyfovom
 
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
bseovas
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
Paul Walk
 
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
ukwwuq
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
ysasp1
 
Understanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdfUnderstanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdf
SEO Article Boost
 
Search Result Showing My Post is Now Buried
Search Result Showing My Post is Now BuriedSearch Result Showing My Post is Now Buried
Search Result Showing My Post is Now Buried
Trish Parr
 
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
bseovas
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
xjq03c34
 
Explore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories SecretlyExplore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories Secretly
Trending Blogers
 
Azure EA Sponsorship - Customer Guide.pdf
Azure EA Sponsorship - Customer Guide.pdfAzure EA Sponsorship - Customer Guide.pdf
Azure EA Sponsorship - Customer Guide.pdf
AanSulistiyo
 
[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024
hackersuli
 
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalmanuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
wolfsoftcompanyco
 
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
cuobya
 
7 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 20247 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 2024
Danica Gill
 

Recently uploaded (20)

Design Thinking NETFLIX using all techniques.pptx
Design Thinking NETFLIX using all techniques.pptxDesign Thinking NETFLIX using all techniques.pptx
Design Thinking NETFLIX using all techniques.pptx
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
 
Discover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to IndiaDiscover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to India
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
 
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
学位认证网(DU毕业证)迪肯大学毕业证成绩单一比一原版制作
 
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
 
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
制作原版1:1(Monash毕业证)莫纳什大学毕业证成绩单办理假
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
 
Understanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdfUnderstanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdf
 
Search Result Showing My Post is Now Buried
Search Result Showing My Post is Now BuriedSearch Result Showing My Post is Now Buried
Search Result Showing My Post is Now Buried
 
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
 
Explore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories SecretlyExplore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories Secretly
 
Azure EA Sponsorship - Customer Guide.pdf
Azure EA Sponsorship - Customer Guide.pdfAzure EA Sponsorship - Customer Guide.pdf
Azure EA Sponsorship - Customer Guide.pdf
 
[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024
 
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalmanuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
 
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
 
7 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 20247 Best Cloud Hosting Services to Try Out in 2024
7 Best Cloud Hosting Services to Try Out in 2024
 

Unleashing Creative Freedom with MODX (2015-09-03 at GroningenPHP)

  • 2. What is your current platform of choice?
  • 3. Who am I? Mark Hamstra Founder & CEA at modmore Freelance MODX Developer my doggies Turbo Bommel
  • 4. Agenda • What is MODX, for whom, available features, how to build a MODX site • Tour of the MODX Manager (back-end) • The Architecture of MODX, xPDO ORM, extending and overriding
  • 5. MOD-what? • Open Source • Written in PHP (of course) • Primarily used with MySQL, other drivers available • Already 10 years old young • Content Management System Framework Platform
  • 7. For who is MODX • Web Professionals • Designers • Front-end developers • Using MODX as a tool • Est 4-5.000.000 sites
  • 8. Community • Professional and helpful • Official Forum: forums.modx.com 50.544 • +- 1M views of modx.com per month • Twitter: #MODX • Slack: modx.org 286
  • 9. All the features of a CMS rich text editor versioning user groups multisite templates multilingual extensions markdown media browser hierarchical page tree commercial support automatic menu builder blogging permissions seo friendly urls server-side caching
  • 11. Elements as Building Blocks Templates TemplateVariables Chunks Snippets Plugins
  • 12. Templates • Usually HTML • Contains MODX tags • One template per page
  • 13. Template Variables • Custom field for resources • Commonly “TV” • Tied to templates • Text, image, select, checkbox, date, radio, richtext, tag and custom types available • [[*name-of-tv]]
  • 14. Chunks • Usually HTML • Reusable piece of code • [[$name-of-chunk]] Template Chunk “head”
  • 15. Snippets • PHP! • Comparable to a function • Accepts properties • [[name-of-snippet]] or 
 [[!name-of-snippet]] Snippet “helloWorld” Template
  • 17. But wait, there’s more! • [[name-of-snippet]] • [[!name-of-snippet]] • = uncached! • [[++name-of-setting]]
 [[!++name-of-setting]] • [[$name-of-chunk]]
 [[!$name-of-chunk]] • [[*name-of-field]]
 [[!*name-of-field]]
  • 18. But wait, there’s even more! • [[helloWorld?
 &property=`value`
 ]] • [[$head?
 &extraCss=`<link rel=.. href=..>`
 ]]
  • 19. Plugins • PHP! • Event-based, so no tags • Can read and often influence behaviour
  • 20. No need to reinvent
 the wheel • Packages (aka extras, add- ons, extensions, third party components…) provide common functionality • Install via Package Installer inside the manager
  • 21. Example: getResources • Lists resources matching conditions • Uses a Chunk as template • Use Cases: • Article listings • Dynamic (sub)menus • RSS feed generation Template Chunk “blogListItem”
  • 22. Time for a Manager Tour! http://localhost/tmp/phpfrl/manager/
  • 24. Secure by Design • Automatic $_GET, $_POST, $_REQUEST sanitisation in the request handler • xPDO ORM prevents SQL Injections • 28 CVE entries, 8 since 2014 • WordPress: 906, already ~85 in 2015 • Drupal: 915, already ~120 in 2015 2015-07, cve.mitre.org
  • 25. xPDO • Object Relational Bridge / ORM • Open Source (modxcms/xpdo) • Extension to PHP’s PDO • Support for MySQL, sqlsrv (and more)
  • 26. Fetching a Single Object $obj = $modx->getObject(‘modChunk’, 5); $c = array(‘name’ => ‘head’); $obj = $modx->getObject(‘modChunk’, $c)
  • 27. Easy Query Builder $c = $modx->newQuery(‘modResource’); $c->where([ ‘parent’ => 0, ‘AND:pagetitle:LIKE => ‘%About%’ ]); $matches = $modx->getCollection(‘modResource’, $c); foreach ($matches as $modResource) { . . . }
  • 28. Automatic Filtering $search = $_POST[‘search’]; $c = $modx->newQuery(‘modResource’); $c->where([ ‘introtext:LIKE’ => “%{$search}%”, ]); $modx->setPlaceholder(‘search’, sanitise($search)); function sanitise($value) { return htmlentities($value, ENT_QUOTES, ‘UTF-8’); } 👍 ⚠
  • 29. Custom Models with xPDO 1. Create an xPDO Package Schema (XML) 2. Use build script to write schema into the actual model files/classes 3. Register it before use ($modx->addPackage) 4. Use any xPDO method (getObject, getCollection) on your custom model
  • 30. xPDO Package Schema - Head <?xml version="1.0" encoding="UTF-8"?> <model package="phpfrl" baseClass="xPDOSimpleObject" platform="mysql" defaultEngine="MyISAM" version="1.1">
  • 31. xPDO Package Schema - Object <?xml version="1.0" encoding="UTF-8"?> <model package=“phpfrl” … <object class="frlMeetup" table=“meetups”> .. fields .. </object> <object class="frlSpeaker" table=“speakers”> … </object> </model>
  • 32. xPDO Package Schema - Fields <?xml version="1.0" encoding="UTF-8"?> <model package=“phpfrl” … <object class="frlMeetup" table=“meetups"> <field 
 key="name" 
 dbtype="varchar" 
 precision="100" 
 phptype="string" 
 null="false" 
 default=“PHP FRL Meetup" />
  • 33. xPDO Package Schema - Indices <?xml version="1.0" encoding="UTF-8"?> <model package=“phpfrl” … <object class="frlMeetup" table=“meetups">
 <field key="name" dbtype=“varchar" …
 <field key=“starts_on" dbtype=“datetime"
 <field key="name" dbtype=“varchar" … <index alias="name" name="name" primary="false" unique="false" type="BTREE">
 <column key="name" length="" collation="A" null="false" />
 </index>
 </object>
  • 34. xPDO Package Schema - Relations <?xml version="1.0" encoding="UTF-8"?> <model package=“phpfrl” baseClass=“xPDOSimpleObject" … <object class="frlMeetup" table=“meetups">
 <field key="name" dbtype=“varchar” …> <composite alias=“Speakers” class=“frlSpeaker” local=“id” foreign=“meetup” cardinality=“many” owner=“local” />
 </object> <object class="frlSpeaker" table=“speakers">
 <field key="name" dbtype=“varchar” …>
 <field key="meetup" dbtype=“int” …> <aggregate alias=“Meetup” class=“frlMeetup” local=“meetup” foreign=“id” cardinality=“one” owner=“foreign” />
 </object>
  • 35. xPDO Generated Model <?php
 class frlMeetup extends xPDOSimpleObject { }
  • 36. Interacting with that model $modx->addPackage(‘phpfrl’, ‘/path/to/model/‘); $c = $modx->newQuery(‘frlMeetup’);
 $c->sortby(‘starts_on’, ‘DESC’);
 $meetup = $modx->getObject(‘frlMeetup’, $c); echo ‘De volgende meetup is ‘ . $meetup->name . ‘ en vind plaats op ‘ . $meetup- >starts_on . ‘. ’; $speakers = $meetup->getMany(‘Speakers’); // or just $meetup->Speakers
 foreach ($speakers as $spegfytaker) {
 echo $speaker->name . ‘ zal vertellen over ‘ . $speaker->subject;
 }
  • 37.
  • 38. Interesting links: • MODX.com => official website • rtfm.modx.com => official documentation • github.com/modxcms/revolution => source code • MODX.today => daily links/articles about MODX • modmore.com => premium extras for MODX • https://joind.in/talk/view/15031 => please leave feedback Enjoy your Creative Freedom