Quick start in MODX Revolution

  • Tutorial
Revolution has grown to version 2.0.8, but most developers are in no hurry to use it, since the documentation is not yet complete, and there are very few articles in Russian.
Personally, I did not find a single step-by-step instruction “for dummies,” and therefore decided to write it myself.

Of course, this is a topic for not "quite dummies", but for people who are even a little familiar with Evolution and when switching to Revolution they broke off from everything unusual, like me. There will be no secrets and clever techniques here. The usual how-to with pictures (there are quite a lot of them).


Personally, I create a new account for% My favorite host% for the new site. It has default access to ssh, which I use.
So, we go to the server, to the site directory (public_html or something like that) and type in the console. So we download the latest Revolution release for today, unpack it and move it immediately to the root of the site. You also need to activate htaccess to use friendly url. If it’s easier for you to do this through the hoster's control panel - to health. MODX is unpacked, you need to create a database for it. This is done from the host admin panel. We create another user and assign him full rights to the database and a better password. At% My favorite host%, this is all done in 6 mouse clicks.
wget modx.com/download/direct/modx-2.0.8-pl.zip
unzip ./modx-2.0.8-pl.zip
mv ./modx-2.0.8-pl/* ./
rm -rf ./modx-2.0.8-pl
mv ./ht.access ./.htaccess

True, I then climb through phpmyadmin and manually set the database type to utf-8, since cp1251 is by default there. utf-8 is a very good thing, I highly recommend using it.

Now you can install MODX. We go to the address% sitename% / setup (yes, not / install!)
If you have PHP 5.3 and get a 503 error, then most likely you need to set your time zone in .htaccess , for example: Click on the buttons. Enter the data to connect to the database. Checking the environment. Installation is completed + deleting the installation files for security purposes. You can enter the control panel with the previously set login and password. Congratulations, MODX is installed!
php_value date.timezone "Asia/Novosibirsk"

Package Installation

By default, Revolution comes completely naked. That is, there is not a single chunk, plugin or snippet. But there is a repository system. Therefore, first of all we put the necessary packages.

We go to the menu System-> package management.

Be sure to set:
Wayfinder - menu generation.
getResources - Ditto replacement, work with resources.
CodeMirror is a syntax highlighted editor.

I also highly recommend
installing TinyMCE - WYSIWYG editor for the smallest. Useful if you don't remember html well.
phpThumbOf - resize images when displayed on the screen. Works like a PHx filter.
Breadcrumbs - a menu chain to display navigation like "Home-> section-> subsection".
translit - automatic transliteration of resource aliases for friendly url.

Here is another table of correspondence snippets Evo and Revo.

Please note that after downloading the packages you also need to install them.

And after installation, it is advisable to put updates on packages, if any.

Workspace setup

We poke System-> System

Setup The system setup is quite different from the Evo in appearance, but the essence is the same. Find the desired parameter and change.
There is a filter by category + search by name. Also, the engine (core) and snippets are separately configured.

I would like to note that it is now possible to create system parameters yourself, so that they can be accessed from your snippets and plugins.
The settings take effect immediately, there are no “save" buttons.

We need to set the site name and friendly url.

In order to automatically generate an alias of friendly url depending on pagetitle, we have already installed the translit package - an analogue of transalias from Evo. Now configure everything as shown in the screenshot.

All other settings are similarly changed.

Almost all

Basically, the typical installation and setup is finished. You can create resources, draw patterns and delight household members with a happy rumbling. Revolution was not so scary.

In conclusion, a few points:
Tag difference

Tag for Evo and Revo

tags Now all tags are enclosed in brackets [[]]: Chunks and snippets are cached, and even, probably, placeholders. To call them without a cache, add the exclamation mark as before.


Built-in PHx

What happened was all that everyone dreamed of! Now PHx is built into the kernel and can be used everywhere!
For those who are not aware that this is a Wikibook . It was written for Evolution, but overall it's the same.

Differences from Evo:
It is called on any placeholder or parameter like this: ANY snippet can act as a filter, which takes the parameters $ output and $ options and gives the result using echo. The simplest use case:

[[*longtitle:is=``:then=`Расширенный заголовок отсутствует`:else=`Заголовок: [[*longtitle]]`]]

Processing TVs

When creating a TV, you can specify the type of output.

Create a TV with the name img, specify the image output type for it, fill in the default parameters, and when displayed on the page as [[* img]] you will have a picture displayed! That is, it’s direct with the tags img title, etc. that indicated. And if you set the output type to text, only the path to the image will be displayed, as before.
By the way, getResources understands this chip.

Snippet getResources

This snippet is the main tool for working with resources. He replaced Ditto2 (Ditto3 for Revo is also there, but it is beta, and will no longer be updated).

Snippet has several differences from Ditto.
1. It does not include the default processing of TV. You need & includeTVs = `1` to immediately process TVs you need & processTVs =` 1`
2. Does not include the output of content by default! Use & includeContent = `1` .
3. The limit on the output of resources by default is 5. I first stupid why I output only 5 documents from any container, since Ditto displayed everything.
4. There is no default template, if you call getResources without & tpl = `` , it will display a list of resources with all properties in an array - very convenient, by the way.
5. There is no startID parameter, there are parents, it works like the same parameter with Ditto.

Resource tree

Resources, as before, can be scattered into categories, but now, categories are invested in each other and you can sort all your snippets and chunks as you like. Yes, now they are also dragged with the mouse and created by the right button, without reloading the page, if necessary.

In general, if you get used to the new resource tree, you just don’t feel like returning to Evolution. Very comfortable, very.


I hope this article helps you learn a little about MODX Revolution. I will be glad to answer questions in the comments and update the topic, as needed.
Basic information on Revolution can be found here .

Also popular now: