About SIMPLX Controller

Go with the flow!

Please see the forum thread for tutorial and information (to be updated since the table syntax has changed a bit)

Many times when building an app on top of Modx i have wanted to do some custom routing depending on state of a form, or a specific url parameter or whatever. In order to cut dev time i began thinking about making a generic routing controller to supplement the Modx system.

With SIMPLX_Controller you can easily execute Snippets depending on Resource URL, QueryString parameter, HTTP method, Cookie value or whatever is present in the Request Message.

Functionality like this is found in most MVC frameworks, so if you have played around with Symfony etc you will find the concept familiar.

Have fun :)

Information

Released
January 25, 2012

Supported Database
MySQL, SQL Server

License
GPLv2

Supported Versions
2.0 - Current

Downloads
3,620

Instructions

Installing

1. Download using Package Management.

2. Go to the simplx_controller Plugin/System Events

3. Set Property Set for the onManagerPageInit/onWebPageInit Events to use the Default set.   

4. Look at the Routing Table Chunk "simplx.controller.routingtable.query.id", which is the default table.

5. Patiently await more documentation ;)

New in 0.8.0-beta4

SIMPLX Controller V0.8 

UPDATE 111109 

 NEW FEATURES: 

 - Added a whole bunch of modResource fields to the Request object. This means that you can route on stuff like:

pagetitle template parent template createdby createdon editedby editedon class_key uri content_type published pub_date unpub_date alias isfolder type templatename 

UPDATE 111028

NEW FEATURES: 

- The Plugin now supports Property Sets

This is very cool as it makes it possible to run different configurations, e.g. Routing Tables, at

different System Events. The Plugin Property Set has the exact same signature as the Snippet set. 

UPDATE 111017 

NEW FEATURES: 

- Routing Instructions now take default parameters. Very handy! 

Example: "GET":["modapi.modchunk.get",{"myproperty":"My default value"}] 

The previous, simple Instruction assignment of course still works

"GET":"modapi.modchunk.default" 

UPDATE 111015 

NEW FEATURES: 

- Now supports regular expressions :D By default, the separator which tells the controller to use regex is "?". See the REST table below for an example. 

- You no longer have to specify a default routing constraint. If none is found the controller defaults to using the first constraint item in the routing table.
  • Loads of fixes :) 

    UPDATE 111005 

    NEW FEATURES: 

    - Better structure to the Routing Table definition by adding named object collections ("constraints","rules","conditions") instead of implicit type naming.

This means that you can basically encode the json and get this interface: 

 $context = $routingtable->constraints->web; 

 $header = $context->header; 

 if($header->rules->content-type){

print 'Hey, I can route on Content-Type!';

I will however shortly make a proper OO PHP Class to manage the Routing Tables. 

FIXES: 

- Default routing was broken. I have done a whole bunch of unit testing cases and it seems to be working now.

Current releases

0.8.0-beta4
View | Download
January 25, 2012
2.0 - Current