MODx Advanced FAQ

If you don't find an answer here, ask for help in the appropriate section of the MODx Forums. If they might have a bearing on your problem, be sure to include your browser version, MODx version, hosting service, Apache version, PHP version, and MySQL version.


Click on a question to expand the answer

Show All      Hide All

What's the difference between site_url and base_url when used in tags?

The site_url is a full URL (e.g. http://bobsguides.com). The base_url is missing the URL prefix (e.g. /bobsguides.com).

Your template should always include a base href statement using the site_url:

<base href="[(site_url)]"></base>

What's the proper way to create a link to a page at my site?

Links in a MODx site should always be expressed with the link tag
[˜##˜]
(where ## is the document ID of the document being linked to. Example:
<a href = "[˜12˜]">Link to document 12</a>

If you would like a fully qualified link for SEO purposes, you can use this form instead:

<a href = "[(site_url)][˜12˜]">Link to document 12</a>

I can't get Friendly URLs to work in XAMPP. What am I doing wrong?

XAMPP has mod_rewrite off by default. Uncomment the following line in xampp/apache/conf/httpd.conf:
LoadModule rewrite_module modules/mod_rewrite.so

How can I get the document ID of the current document in a plugin?

$docid = $e->params['id'];

What other params are available to plugins attached to system events?

It depends on the event. Susan Ottwell has a good list here. They are available as simple variables. Another list can be found here.

What causes this error? Fatal error: Allowed memory size of 33554432 bytes exhausted

This almost always means that you have a circular reference on your site. A page forwards users to another page that forwards users back to the first page, ad infinitum. The most common cause is having an unpublished or missing error or unauthorized page. User's who try to access a non-existent URL are forwarded to the error page. If the error page isn't published, it too doesn't exist and they're forwarded again to the same page over and over until the memory runs out. Check the error_page and unauthorized_page system settings and make sure the pages referred to there are published and not protected by a permission setting.

Another possibility is a snippet such as Ditto, that pulls content from a page that has the same Ditto tag on it (or in the template attached to it).

Finally, if your memory limit is 32M or less, Ditto and some other snippets can exhaust it in their normal operation. Try increasing the memory_limit setting in php.ini.

I have extra back-slashes showing up in my code. Where are they coming from?

You need to turn of magic_quotes_gpc. Look here.

How can I send parameters in a URL from a snippet in Revolution?

Create the URL with $modx->makeURL() like this:
$url = $modx->makeUrl($id, '', 'paramName=value');

How did you create this marvelous FAQ?

The FAQ uses some JavaScript code from DynamicDrive.com and is extremely easy to create and maintain in MODx thanks to the EZfaq Snippet, created by (ahem) me. Go here to see the EZfaq tutorial.

When I cut and paste code from this site, it doesn't always work. Why?

In order to keep MODx from executing the code, an HTML comment is sometimes inserted in the code. If you cut and paste, you may have to remove those comments:
<!-- -->

Thank you for visiting BobsGuides.com

  —  Bob Ray