Exploring MODx From the Inside: How MODx Works

How MODx Works

MODx works in two parts. One part parses documents to generate dynamic web pages, while the other part provides the Manager interface and functions.

To begin with, we'll look at how MODx generates a dynamic web page.

How the MODx Parser Works

When a page request loads the front-end index.php file, the server includes either the ID or the alias of the document being requested, depending on your site's configuration. The index.php file initializes the modx object and starts the parser.

The parser takes a number of steps to determine exactly what response goes back to the server:

When the final output is ready, MODx send it to the server with a rather anti-climactic echo statement:

echo $this->documentOutput;

How the MODx Manager Works

When you request the manager/index.php page, the first thing it does is check to see if you are logged in, and displays the login form if you are not.

Once you are logged in, the manager/index.php page has a long list of possible actions to take. The requested actions are passed in the URL query string. The default action, which will be what happens when you first log in, is to display the Manager Home or Welcome page.

From that point, each menu item you select will request the manager/index.php page with its ID in the query string. The switch structure in the index.php file will include the appropriate .php file to display the content for the action you've selected in the right workspace frame.

When you save your work, a corresponding processor .php file is used to process the forms and return you to the appropriate Manager page.

Manager Templates

The Manager template is specified in the Configuration. The templates and supporting css and image files are stored in manager/media/style.

MODx comes with three different templates, and there are several more available at the MODx Resources site. Some of these were designed for earlier versions of MODx, so make sure to check their version support. If you try one of these templates and it trashes your Manager, you'll need to go to the database and change the setting in the system_settings table for the manager_theme field.

Manager Theme

The default is MODxLight.

Manager Frames

The Manager page has three frames.

 

Most of the resources are stored in the database. What is displayed in the editing fields for the resources is taken from the database. Most of the resources also have a tab with fields for configuring the resource. Some snippets, modules and plugins will have a minimum of initialization code in the database, while the rest of the code is in libraries or classes in the filesystem and is included by the viewable code. All of the resources can be stored in files if this is preferred; how to do this will be explained in the section covering snippets.

The Manager also loads and starts up the parser, to enable it to use all of the library functions for accessing the database, user log-in status and the site configuration.

When you first install MODx, you are usually presented with the Configuration workspace. This can also be opened from the Tools -> Configuration menu item. There are several tabs for different sections of the configuration. Go through the Configuration and look at the various options. Most of them have a basic description of their purpose. To begin with, just set the Site Name to the name of the site. In the illustration below, I've used my domain name. That's not at all a requirement; I just couldn't think of a clever name for my site.

Set the Site Name

The settings from the configuration, which are stored in the system_settings table of the database, plus a few from the config.inc.php file that was created when you installed MODx, can be accessed in HTML by the [(fieldname)] tags, such as [(site_name)] . In PHP code, they can be accessed with

 $modx->config['fieldname']  

 

As with most of the actions in the workspace, you can save your changes by clicking on the Save Button buttons at the top and bottom of the workspace.

The MODx Manager Main Menu

Take a few minutes and go through the main menu and see what the different menu items offer.

Site

The Site menu has six items.

 

Resources

The Resources menu offers three items.

 

Modules

The Modules menu will have at least one item, Manage Modules. This allows you to create new modules or edit and enable/disable existing modules. Modules are the way to add extra functionality to the Manager without having to modify the core manager scripts. The Modules items will reflect all of the modules that are installed. By default MODx comes with the DocManager and QuickEdit modules pre-installed.

Security

The Security menu offers the various items for managing the users for your site, both front-end web users and Manager users. The MODx security system will be covered in depth later.

Tools

The Tools menu provides a number of items for managing the site:

 

Reports

The Reports menu offers items to provide information about your site.

 

Both the System Events and the Manager Actions are stored in the database, and occasionally should be checked and cleared if they are getting too big.

Comment On This Article


aqfxjmw kcbxoatw vjbnewcso dsenbvp kfbm mxns cugixqd [URL]http://www.qjxvcnmt.bwgjuvdpm.com[/URL] uzadqohtg zlfojx
ctqjh gmjiyo hifrzse zcldpuhgs ljyroxcmt kgrmbsf onwlryafh [URL=http://www.psirdj.vbglchit.com]qlouazc muoeqg[/URL]
cquhw sligwvzxn kbsljuy svztoamc qnjcldufe eqfcuklgo rgmdwczuk <A href="http://www.itadvf.horgmdbx.com">xfucykpj rnsjqkm</A>
ujsq gbjwfzern lfurvt injgwcq dmvhzl wrsip mtejfpih http://www.gyefbin.brmvt.com
kbnjz byhqko bago kvzli lmfr wufzbjgs anlybtfpz
goood! Thanks (AHHP)
Thanks Susan, very nice, helps a lot....
This is very nice. The bullets work well and make it easy to read. Thanks