MODx 2.0: Web Development Basics

0
103
7 min read

 

MODx Web Development – Second Edition

MODx Web Development - Second Edition

Build dynamic websites with MODx PHP application framework and CMS

        Read more about this book      

(For more resources on the subject, see here.)

Site configuration

When you first log in to the MODx Manager interface, you will see the site configuration page in the rightmost panel. Here, you can customize some basic configurations of the site. You can reach this page from anywhere in the MODx Manager by clicking on the Configuration sub-menu in the Tools menu.

All of the options that can be configured from this Configuration page are settings that are global to the entire site. After changing the configurations, you have to let MODx store them by clicking on the Save button.

The following is the screenshot of the Configuration page:

(Move the mouse over the image to enlarge it)

The configurations are grouped into five categories:

  • Site—mostly, settings that are used to personalize the site
  • Friendly URLs—settings to help make the site search-engine optimized
  • User—settings related to user logins
  • Interface & Features—mostly, Manager interface customizations
  • File Manager—settings defining what can be uploaded and where

Configuring the site

In this section, we are going to make a few changes to get you familiar with the various configurations available. Most configurations have tooltips that describe them in a little pop-up when you move the mouse over them.

After making changes in the site configuration and saving it, you will be redirected to another page. This page is available by clicking on the Home link on the Site tab. This page is also the default Manager interface page. This means that every time you log in using the Manager login screen, you will reach this page by default.

This page has seven tabs, which are briefly explained below:

  • My MODx Site: Provides quick access to certain features in MODx.
  • Configuration: Displays information on the current status of the site.
  • MODx News: Shows updates on what is happening with MODx.
  • Security Notices: Shows updates on what is happening with MODx that is specific to security.
  • Recent Resources: Shows a list with hyperlinks of the recently created or edited resources.
  • Info: Shows information about your login status.
  • Online: Lists all of the active users.

Noticing and fixing errors and warnings

The Configuration tab of the default Manager interface page displays errors and warnings about issues in the installation, if any. Generally, it also has instructions on how to fix them. Most of the time, the warnings are for security issues or suggestions for improving performance. Hence, although the site will continue to work when there are warnings listed on this page, it is good practice to fix the issues that have caused these warnings.

Here we discuss three such warnings that occur commonly, and also show how to fix them.

  • config file still writable: This is shown when the config file is still writable. It can be fixed by changing the properties of the configuration file to read only.
  • register_globals is set to ON in your php.ini configuration file: This is a setting in the PHP configuration file. This should be set to OFF. Having it ON makes the site more vulnerable to what is known as cross site scripting (XSS).
  • Configuration warningGD and/or Zip PHP extensions not found: This is shown when you do not have the specified packages installed with PHP. MAMP doesn’t come with the ZIP extension and you can ignore this configuration if you are not using it in production. Both XAMPP and MAMP come with the GD extension by default.

Changing the name of the site

In the previous section, we listed the groups of configuration options that are available. Let us change one option—the name of the site—now.

  1. Click on the Tools menu in the top navigational panel
  2. Click on the Configuration Menu item
  3. Change the text field labeled Site Name to Learning MODx
  4. Click on the Save button

The basic element of MODx: Resources

Resources are the basic building blocks in MODx. They are the elements that make up the content of the site. Every web page in MODx corresponds to a Resource page. In early versions of MODx, Resources were called Documents. Thinking of them as documents may make it easier for you to understand. Every resource has a unique ID. This ID can be passed along in the URL, and MODx will display the page for the resource with the same ID. In the simplest case, a resource contains plain text.

As can be seen from the previous screenshot, the ID referred to here is 2, and the content displayed on the screen is from resource ID 9. It is also possible to refer to a resource by an alias name instead of an ID. An alias is a friendly name that can be used instead of having to use numbers.

Containers

Resources can be contained within other resources called containers. Containers in MODx are like folders in filesystems, but with the difference that a container is also a resource. This means that every container also has a resource ID, and a corresponding page is shown when such an ID is referenced in the URL.

MODx Manager interface

MODx is administered and customized by using the provided Manager interface. From the Manager interface, you can edit resources, place them within containers, and change their properties. You can log in to the Manager interface by using the Manager login screen http://sitename/manager, by using the username and password that you supplied when installing MODx. The Manager interface is divided into two panes. The leftmost pane always displays the resources in a resource tree, and the rightmost pane displays the content relevant to your last action.

The two preceding panes you see are the menu and the corresponding menu items. Each of these leads to the different functionalities of MODx.

In the leftmost pane, you will see the site name followed by a hierarchically-grouped resource list. There is a + near every unexpanded container that has other resources. When you click on the + symbol, the container expands to show the children and the + symbol changes to a – symbol. Clicking on the – symbol hides the children of the respective container. The resource’s ID is displayed in parentheses after the resource’s title in the resource tree.

The top of leftmost pane consists of a few icons, referred to as the Resource Toolbar, which help to control the visibility of the resource tree.

  • Expand Site Tree—expand all of the containers to show their children and siblings.
  • Collapse Site Tree—collapse all of the containers to hide their children and siblings.
  • New Resource—open a new resource page in the rightmost pane.
  • New Weblink—open a new weblink page in the rightmost pane.
  • Refresh Site Tree—refresh the tree of containers and resources to make available any changes that are not yet reflected in the tree.
  • Sort the Site Tree—open a pop-up page where you can select from the various criteria available to sort the tree.
  • Purge—when you delete a resource, it stays in the recycle bin. The resources are struck out with a red line. The resources can be completely removed from the system by clicking on the Purge icon.
  • Hide Site Tree—this icon slides the leftmost pane out of view, giving more space for the rightmost pane.

Right-clicking on a resource brings up a context menu from where you can perform various actions on the resource. Clicking on Edit will open the page for editing in the rightmost pane. The context menu provides interesting shortcuts that are very handy.

LEAVE A REPLY

Please enter your comment!
Please enter your name here