<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TipsFor.us &#187; MODx</title>
	<atom:link href="http://tipsfor.us/category/software/modx/feed/" rel="self" type="application/rss+xml" />
	<link>http://tipsfor.us</link>
	<description>Tech Tips, Reviews, Tutorials, Occasional Rants</description>
	<lastBuildDate>Mon, 10 May 2010 18:00:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Writing Custom PHP Snippets for MODx (part VII)</title>
		<link>http://tipsfor.us/2009/11/02/writing-custom-php-snippets-for-modx-part-vii/</link>
		<comments>http://tipsfor.us/2009/11/02/writing-custom-php-snippets-for-modx-part-vii/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 07:11:54 +0000</pubDate>
		<dc:creator>Everett - TipsFor.us</dc:creator>
				<category><![CDATA[MODx]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Modules]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://www.tipsfor.us/?p=2497</guid>
		<description><![CDATA[<p>This article and tutorial video takes on how to add custom PHP scripts (known as Snippets) to the MODx content management system.  This covers MODx Evolution (version 1.0 and before), but many of these methods and principles are applicable to MODx Revolution (version 2.0) and PHP coding in general.</p>
<p><p>Click here to view the embedded [...]<p>Post from: <a href="http://www.tipsfor.us">TipsFor.us</a><br /><br/><br/><a href="http://tipsfor.us/2009/11/02/writing-custom-php-snippets-for-modx-part-vii/">Writing Custom PHP Snippets for MODx (part VII)</a></p>
]]></description>
			<content:encoded><![CDATA[<p>This article and tutorial video takes on how to add custom PHP scripts (known as Snippets) to the MODx content management system.  This covers MODx Evolution (version 1.0 and before), but many of these methods and principles are applicable to MODx Revolution (version 2.0) and PHP coding in general.</p>
<p><p><a href="http://tipsfor.us/2009/11/02/writing-custom-php-snippets-for-modx-part-vii/"><em>Click here to view the embedded video.</em></a></p><br />
<a href="http://blip.tv/file/2797082">Watch Video @ Blip.Tv</a></p>
<h2>Adding a Snippet</h2>
<p>MODx newcomers are sometimes confused as to where to upload the PHP files&#8230; <em>YOU DON&#8217;T UPLOAD IT</em>.  You paste it into a database record.  You can reference files on the file system, but you don&#8217;t have to.   </p>
<p>1.  To add a Snippet from the MODx (v1) manager go to <strong>Elements &#8211;> Manage Elements &#8211;> Snippets</strong> then paste in your PHP code.<br />
2.  Be sure to give it a unique name (I recommend avoiding spaces in the name)<br />
3. Give it a category: this will make your Snippet easier to find in the manager.</p>
<h2>Recommended Components of a PHP Snippet</h2>
<p>This applies to ANY code you write, but for the record, please include the following documentation as comments in your Snippet:<br />
<strong>1.  SUMMARY:</strong>  a sentence describing what the Snippet does.<br />
<strong>2. INPUT:</strong> list any input variables the Snippet can accept.  It&#8217;s good to note the data type (e.g. integer/string), whether or not they are required, or whether or not they have a default value.<br />
<strong>3. OUTPUT</strong>: list any special output created by the Snippet.  Usually it&#8217;ll just be HTML, but it&#8217;s good to note any external actions (e.g. whether it updates a database row).<br />
<strong>4. EXAMPLE:</strong> give an example of how the Snippet should be called.</p>
<h3>Sample Comment Block</h3>
<p><code><br />
<?php<br />
/*---------------------------------------------------------<br />
SUMMARY: Formats list of cartoon characters using referenced chunk<br />
INPUT:<br />
	$chunk_name = string; Name of Chunk to be used for formatting output.<br />
OUTPUT:<br />
	HTML or it logs an error.<br />
EXAMPLE:<br />
	[!ComicExample? &#038;chunk_name=`myChunk`!]<br />
----------------------------------------------------------*/<br />
?><br />
</code></p>
<h2>Coding Suggestions and Rules of Thumb</h2>
<p><strong>1. Develop your Interface before you code:</strong> that bit about adding comments isn&#8217;t just for other users, it can help you determine how you want to be able to interact with your code.  Coding to an interface is good way of establishing goals and structure before you even start writing the actual code.<br />
<strong>2. Initialize your variables:</strong>  This cuts down on the possibility of security exploits, bugs, and it makes your code easier to read, e.g.:<br />
<code>$output = '';<br />
$garfield_characters_array = array();<br />
</code><br />
<strong>3. Sanitize your input:</strong> if you are getting any user entered data (e.g. anything out of the $_POST or $_GET array), sanitize the data using regular expressions and if/then statements.  Make SURE you have eliminated any possibility that the data is something other than what your program expects.<br />
<strong>4. Test as you Go:</strong> PHP doesn&#8217;t have a built-in debugger, so don&#8217;t go too long without checking to see if your code still &#8220;compiles&#8221; (technically, you should check to see if it has a valid syntax and if it executes).  Checking often will help you track down where you made a mistake.<br />
<strong>5. Use Good Variable and Function Names:</strong> be descriptive.  Don&#8217;t become a member of the hated &#8220;ASCII Preservation Society&#8221;.  Besides, if you use unique variable names, it becomes MUCH easier to search for instances of that variable, and you&#8217;re less likely to have variable collisions.<br />
<strong>6. Group your Code into Units:</strong> In a word, use functions that fit on the page.  If you can SEE it, you&#8217;re less likely to UNDERSTAND IT.  Chapters of uninterrupted code are hard to debug and test.<br />
<strong>7. Reuse your Code:</strong> if there are cases in your code where you&#8217;re copying and pasting identical or NEARLY identical parts, then it&#8217;s time to relegate that code to its own separate function.<br />
<strong>8. Log your Errors:</strong> if something goes wrong, let your users know about it.  It&#8217;s a wonderful thing to use the <a href="http://wiki.modxcms.com/index.php/API:logEvent">MODx logging function</a>.<br />
<strong>9. DO NOT MIX  HTML and PHP!</strong>  There are a few cases where where this is acceptable, but it is good architectural design to separate your view (i.e. your HTML) from your logic.  If you have to edit your PHP code to change div tags or CSS classes, then you probably did something wrong.  Instead, use MODx Chunks to format Snippet output; your code will be MUCH cleaner as a result and MUCH easier to maintain.</p>
<h2>Including Files from the File System</h2>
<p>If you write anything more than simple Snippets, you&#8217;ll want to put your PHP file(s) on the file system and reference them from the Snippet stored in the MODx database.  You can do this by including a standard include or require statement, e.g.</p>
<p><code>include($modx->config['base_path'].'assets/snippets/mysnippet/include_me.php');</code></p>
<p>The standard MODx location would be in your own folder within the <strong>/assets/snippets</strong> directory.</p>
<h3>Things to Remember When Including Files and Using Functions</h3>
<p><strong>1. Variable Scope: </strong>the $modx super-object and the methods that go along with it will not remain in scope within a funciton; use the <strong>global</strong> to ensure that the globally scoped $modx variable instance is used inside the function.  Compare the two instances of the same API call:<br />
<code>// INSIDE a function<br />
function inside_a_function($chunk_name,$garfield_characters_array)<br />
{<br />
	global $modx;<br />
	$output = $modx->parseChunk($chunk_name, $garfield_characters_array, '[+', '+]');<br />
	return $output;<br />
}</p>
<p>// Or OUTSIDE a function<br />
$output = $modx->parseChunk($chunk_name, $garfield_characters_array, '[+', '+]');</code></p>
<p><strong>2. You can&#8217;t return a value directly from an included file:</strong> because MODx treats Snippets as functions, it&#8217;s considered good form to always return a value, e.g. &#8220;return $output;&#8221; or &#8220;return TRUE;&#8221; but this MUST be returned from the original Snippet in the database; if you return output from the included file, you&#8217;ll have to return it again from the original database Snippet code.  See the video for this quirk in action.<br />
<strong>3. Take advantage of the File System:</strong> if you are developing stand-alone PHP files, you can use the bash terminal (on Linux or OS X machines) to test the PHP syntax.  Simply navigate to the directory where your file is and type:<br />
<code>php -l name_of_your_file.php</code></p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://tipsfor.us/2009/05/01/creating-templates-in-modx-part-ii-part-v-in-the-series/" rel="bookmark" class="crp_title">Creating Templates in MODx Part II (part V in the series)</a></li><li><a href="http://tipsfor.us/2009/04/30/creating-templates-in-modx-part-i-part-iv-in-the-series/" rel="bookmark" class="crp_title">Creating Templates in MODx Part I (part IV in the series)</a></li><li><a href="http://tipsfor.us/2008/11/21/stealth-submit-using-ajax-to-save-form-data-without-submitting-the-form/" rel="bookmark" class="crp_title">Stealth Submit: Using AJAX to Save Form Data Without Submitting the Form</a></li><li><a href="http://tipsfor.us/2008/11/27/checking-to-see-if-packages-are-installed-in-php-or-perl/" rel="bookmark" class="crp_title">Checking to See if Packages are Installed in PHP or Perl</a></li><li><a href="http://tipsfor.us/2009/01/27/installing-modx-modx-series-part-iii/" rel="bookmark" class="crp_title">Installing MODx (MODx Series Part III)</a></li></ul></div><p>Post from: <a href="http://www.tipsfor.us">TipsFor.us</a><br /><br/><br/><a href="http://tipsfor.us/2009/11/02/writing-custom-php-snippets-for-modx-part-vii/">Writing Custom PHP Snippets for MODx (part VII)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tipsfor.us/2009/11/02/writing-custom-php-snippets-for-modx-part-vii/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Forgot your MODx Password?  You can reset it&#8230;</title>
		<link>http://tipsfor.us/2009/10/25/forgot-your-modx-password-you-can-reset-it/</link>
		<comments>http://tipsfor.us/2009/10/25/forgot-your-modx-password-you-can-reset-it/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 04:35:50 +0000</pubDate>
		<dc:creator>Everett - TipsFor.us</dc:creator>
				<category><![CDATA[MODx]]></category>
		<category><![CDATA[change]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[reset]]></category>

		<guid isPermaLink="false">http://www.tipsfor.us/?p=2475</guid>
		<description><![CDATA[<p>I have *cough* never forgotten my password to anything because I followed Brian&#8217;s excellent advice about storing passwords, but just in case some of you have, I thought I&#8217;d help you out.</p>
<p class="wp-caption-text">If you have access to your MySQL database, you can still log into the MODx manager.</p>
<p>First off, if you are locked out of [...]<p>Post from: <a href="http://www.tipsfor.us">TipsFor.us</a><br /><br/><br/><a href="http://tipsfor.us/2009/10/25/forgot-your-modx-password-you-can-reset-it/">Forgot your MODx Password?  You can reset it&#8230;</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I have *cough* never forgotten my password to anything because I followed Brian&#8217;s excellent advice about <a href="http://www.tipsfor.us/2008/09/20/keepass-never-remember-a-password-again/">storing passwords</a>, but just in case some of you have, I thought I&#8217;d help you out.</p>
<div id="attachment_2476" class="wp-caption aligncenter" style="width: 474px"><img src="http://www.tipsfor.us/wp-content/uploads/2009/10/Manager-Login.jpg" alt="If you have access to your MySQL database, you can still log into the MODx manager." title="MODx 1.0 Manager Login" width="464" height="379" class="size-full wp-image-2476" /><p class="wp-caption-text">If you have access to your MySQL database, you can still log into the MODx manager.</p></div>
<p>First off, if you are locked out of your MODx manager, you can use the standard link on the manager page to email you your password, but I&#8217;m outlining how to do this in the event that you either didn&#8217;t enter a valid email address or you aren&#8217;t receiving your emails somehow.  There are two things I&#8217;m going to outline:</p>
<ol>
<li>Resetting your MODx manager password</li>
<li> Adding a new MODx manager user </li>
</ol>
<p><strong>WARNING: Both options require that you have read/write access to the MySQL database where the MODx information is installed.  PROCEED WITH CAUTION&#8230; THIS REQUIRES DATABASE EDITS.</strong></p>
<p>Option 1 is nicely outlined by this article at Lucid Green: <a href="http://www.lucidgreen.net/webbybooth/?p=27">How to get into MODx when your blocked or lost your password</a>.  The article is a bit dated (2006), but it&#8217;s still valid&#8230; to summarize, do the following:</p>
<h2>Resetting Your MODx Manager Password</h2>
<p>We&#8217;re going to do two things here: change your password, and clear any blocks on your manager user.</p>
<ol>
<li>Login to your site&#8217;s database (e.g. using phpMyAdmin). </li>
<li>Find the table <strong>modx_manager_users</strong> &#8211;in phpMyAdmin, find the table in the list on the left.
<div id="attachment_2486" class="wp-caption aligncenter" style="width: 199px"><img src="http://www.tipsfor.us/wp-content/uploads/2009/10/list-of-tables.jpg" alt="phpMyAdmin lists all tables on the left-hand side" title="List of tables" width="189" height="302" class="size-full wp-image-2486" /><p class="wp-caption-text">phpMyAdmin lists all tables on the left-hand side</p></div>
<p>NOTE: the <em>modx_</em> is the default table prefix&#8230; your installation may use a different prefix, or it may use no prefix.  If you honestly can&#8217;t the table, you may have to resort to the following query to find the table: <code>SHOW TABLES LIKE '%manager_users';</code><br />
<div id="attachment_2479" class="wp-caption aligncenter" style="width: 357px"><img src="http://www.tipsfor.us/wp-content/uploads/2009/10/Find-the-damn-table.jpg" alt="Can&#039;t find the table? SHOW TABLES WHERE ..." title="Find the @!#$% table" width="347" height="61" class="size-full wp-image-2479" /><p class="wp-caption-text">Can't find the table? SHOW TABLES WHERE ...</p></div></p>
<p>Type that at the MySQL prompt and any tables with a name <em>ending</em> in &#8220;manager_users&#8221; will be shown.</li>
<li>Select your user from the list &#8212;  in phpMyAdmin you can click the &#8220;Browse&#8221; tab to browse the rows in each table.  Choose to CHANGE or EDIT the row.<br />
<div id="attachment_2480" class="wp-caption aligncenter" style="width: 496px"><img src="http://www.tipsfor.us/wp-content/uploads/2009/10/phpMyAdmin-edit-row.jpg" alt="Edit your user" title="Edit the row" width="486" height="74" class="size-full wp-image-2480" /><p class="wp-caption-text">Edit your user</p></div></li>
<li>Select the MD5 function to operate on the password column.  In phpMyAdmin, when you edit a record, you can use functions to operate on each column.  Once you&#8217;ve selected to use the MD5 function, you can type your new password normally.<br />
<div id="attachment_2481" class="wp-caption aligncenter" style="width: 814px"><img src="http://www.tipsfor.us/wp-content/uploads/2009/10/update-password.jpg" alt="Make sure you use the MD5 function!" title="Update your password" width="804" height="188" class="size-full wp-image-2481" /><p class="wp-caption-text">Make sure you use the MD5 function!</p></div></p>
<p>If you are doing this via the MySQL command line, the actual query we execute looks something like this:<br />
<code>UPDATE  `your_db`.`modx_manager_users` SET  `password` = MD5(  'changeme' ) WHERE  `modx_manager_users`.`id` =1 LIMIT 1 ;</code></p>
<p>NOTE: if you execute this query at the command line, you must type apostrophes to delineate your password (they will not be included as part of the password).  If you are doing this via phpMyAdmin, do NOT type the apostrophes.</li>
<li>Save the changes to the row.</li>
<li>Please note the id for the row that you just edited&#8230; you may need it.</li>
<li>Go to the <strong>modx_user_attributes</strong> table and find your manager user and edit this row (here&#8217;s where it&#8217;s handy to have that id from the above steps.</li>
<li>Change only the following items then save the row:<br />
* Set “blockeduntil” to zero (0).<br />
* Set failedlogincount to zero (0).<br />
<div id="attachment_2482" class="wp-caption aligncenter" style="width: 620px"><img src="http://www.tipsfor.us/wp-content/uploads/2009/10/User-Attributes.jpg" alt="Remove blocks on your user" title="Update User Attributes" width="610" height="572" class="size-full wp-image-2482" /><p class="wp-caption-text">Remove blocks on your user</p></div><br />
On the MySQL command line, your query looks something like this:<br />
<code>UPDATE  `your_db`.`modx_user_attributes` SET  `blockeduntil` =  '0',`failedlogincount` =  '0'  WHERE  `modx_user_attributes`.`id` =1 LIMIT 1 ;</code>
</li>
<li>You should now be done&#8230; head over to yourdomain.com/manager and login using your new password. </li>
</ol>
<h2>Adding a New MODx Manager User</h2>
<p>This is a bit more devious, but the commands aren&#8217;t much different than the above, except that we are INSERTING rows into 2 tables instead of UPDATING them.  There are many times I&#8217;ve needed to &#8220;let myself in&#8221; using this technique&#8230; </p>
<ol>
<li>As above, login to your site&#8217;s database (e.g. using phpMyAdmin).</li>
<li>As above, find the table <strong>modx_manager_users</strong> &#8211;in phpMyAdmin, find the table in the list on the left. (If you have trouble finding the table, see the tip in step #2 above).</li>
<li>Instead of updating an existing record, we are going to create one &#8212; in phpMyAdmin, click the &#8220;INSERT&#8221; tab.  Be sure that you do the following:<br />
* type a valid username (usually, this is one word, lowercase)<br />
* type a valid password (use the MD5 function!)<br />
* Leave the id field blank (it will auto-increment).<br />
* Select &#8220;MD5&#8243; as the function for the password field (don&#8217;t forget!)<br />
* Leave the &#8220;Ignore&#8221; box checked &#8212; phpMyAdmin allows you to insert a couple rows at once, but we only need to insert one.<br />
<div id="attachment_2483" class="wp-caption aligncenter" style="width: 791px"><img src="http://www.tipsfor.us/wp-content/uploads/2009/10/Inserting-new-user.jpg" alt="Create a new User" title="Create a new User" width="781" height="337" class="size-full wp-image-2483" /><p class="wp-caption-text">Create a new User</p></div></p>
<p>Then click Go to insert the new record.  </p>
<p>The actual MySQL query used here is something like this:<br />
<code>INSERT INTO `your_db`.`modx_manager_users` (<br />
`username` ,<br />
`password`<br />
)<br />
VALUES (<br />
'everett', MD5( 'changeme' )<br />
);<br />
</code>
</li>
<li>Remember the id of the newly inserted user!  You&#8217;ll need it &#8212; phpMyAdmin shows it after the row was inserted.  If you misplaced it, you can simply browse the table and find your user &#8212; remember the id!<br />
<div id="attachment_2484" class="wp-caption aligncenter" style="width: 255px"><img src="http://www.tipsfor.us/wp-content/uploads/2009/10/Insert-ID.jpg" alt="The new User&#039;s ID is shown here" title="The new User&#039;s ID" width="245" height="100" class="size-full wp-image-2484" /><p class="wp-caption-text">The new User's ID is shown here</p></div></li>
<li>Go to the <strong>modx_user_attributes</strong> table and insert a new row:<br />
Add the following values:<br />
* <strong>id</strong> LEAVE BLANK.  It will auto-increment.<br />
* <strong>internalKey</strong> should also be equal to the your user id from step 4.<br />
* role = 1 (for manager users)</p>
<p>The actual query looks something like this:<br />
<code>INSERT INTO `your_db`.`modx_user_attributes` (`internalKey` ,<br />
`role`<br />
)<br />
VALUES (<br />
'9', '1'<br />
);</code></li>
<li>That&#8217;s it.  You should now be able to use that username and password to login into your MODx manager at www.yourdomain.com/manager</li>
</ol>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://tipsfor.us/2009/04/30/creating-templates-in-modx-part-i-part-iv-in-the-series/" rel="bookmark" class="crp_title">Creating Templates in MODx Part I (part IV in the series)</a></li><li><a href="http://tipsfor.us/2009/01/22/new-overview-of-modx-modx-series-part-ii/" rel="bookmark" class="crp_title">New Overview of MODx (MODx Series Part II)</a></li><li><a href="http://tipsfor.us/2010/05/10/basic-web-security/" rel="bookmark" class="crp_title">Basic Web Security</a></li><li><a href="http://tipsfor.us/2008/11/21/stealth-submit-using-ajax-to-save-form-data-without-submitting-the-form/" rel="bookmark" class="crp_title">Stealth Submit: Using AJAX to Save Form Data Without Submitting the Form</a></li><li><a href="http://tipsfor.us/2009/05/26/enabling-seo-friendly-urls-in-modx-part-vi-in-the-series/" rel="bookmark" class="crp_title">Enabling SEO Friendly URLs in MODx (part VI in the series)</a></li></ul></div><p>Post from: <a href="http://www.tipsfor.us">TipsFor.us</a><br /><br/><br/><a href="http://tipsfor.us/2009/10/25/forgot-your-modx-password-you-can-reset-it/">Forgot your MODx Password?  You can reset it&#8230;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tipsfor.us/2009/10/25/forgot-your-modx-password-you-can-reset-it/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enabling SEO Friendly URLs in MODx (part VI in the series)</title>
		<link>http://tipsfor.us/2009/05/26/enabling-seo-friendly-urls-in-modx-part-vi-in-the-series/</link>
		<comments>http://tipsfor.us/2009/05/26/enabling-seo-friendly-urls-in-modx-part-vi-in-the-series/#comments</comments>
		<pubDate>Tue, 26 May 2009 18:48:04 +0000</pubDate>
		<dc:creator>Everett - TipsFor.us</dc:creator>
				<category><![CDATA[MODx]]></category>

		<guid isPermaLink="false">http://www.tipsfor.us/?p=2199</guid>
		<description><![CDATA[<p class="wp-caption-text">Apache .htaccess Rewrites are Powerful</p>
<p>Many content management systems rely on URL parameters like ?page=3 to determine which page is displayed to the user.  MODx (like many other CMS&#8217;s) can use Apache&#8217;s .htaccess file to rewrite URLs so they are easier to read, e.g. www.mydomain.com/modx/tutorial, and this usually results in higher SEO scores.  [...]<p>Post from: <a href="http://www.tipsfor.us">TipsFor.us</a><br /><br/><br/><a href="http://tipsfor.us/2009/05/26/enabling-seo-friendly-urls-in-modx-part-vi-in-the-series/">Enabling SEO Friendly URLs in MODx (part VI in the series)</a></p>
]]></description>
			<content:encoded><![CDATA[<div id="attachment_2215" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-2215" title="Apache .htaccess Rewrites are Powerful" src="http://www.tipsfor.us/wp-content/uploads/2009/05/chalkboard-streetfighter-01.jpg" alt="Apache .htaccess Rewrites are Powerful" width="500" height="300" /><p class="wp-caption-text">Apache .htaccess Rewrites are Powerful</p></div>
<p>Many content management systems rely on URL parameters like <strong>?page=3</strong> to determine which page is displayed to the user.  MODx (like many other CMS&#8217;s) can use Apache&#8217;s .htaccess file to rewrite URLs so they are easier to read, e.g. <strong>www.mydomain.com/modx/tutorial</strong>, and this usually results in higher SEO scores.  This article and its video walk you through how to accomplish this for MODx running on an Apache web server.  Windows servers have something similar, they just charge more for it (haha).</p>
<p>Here&#8217;s the video.  I was going to re-do this in high-def, but this was one of those lightning-strike rants that I was on&#8230; I just know it wouldn&#8217;t be as good if I attempted to remake it.<br />
<p><a href="http://tipsfor.us/2009/05/26/enabling-seo-friendly-urls-in-modx-part-vi-in-the-series/"><em>Click here to view the embedded video.</em></a></p></p>
<p><em>* I mispronounced MODx in the video (sorry).  It should be &#8220;mod&#8221; as is &#8220;modular&#8221;.</em></p>
<h2>The Quickie Text Version of the Video</h2>
<ol>
<li>Make sure MODx is installed and your site works.</li>
<li>Go to the root of your site, verify that you have an .htaccess file (MODx often includes a dummy file named &#8220;ht.access&#8221; which needs to be renamed before it is parsed).  Be sure to keep a backup copy of the original!</li>
<li>Edit the .htaccess file and type some junk at the very top of the file.  For example, type in &#8220;asdpfasdfj&#8221; at the top of the file, then save it.  Now try to visit any page on your site.  You should get an server error, and this is GOOD!  This means that the .htaccess file is being parsed, so go back and delete that junk from the file.  If you don&#8217;t get an error, it means that the .htaccess file is NOT being parsed, and you may need to contact your ISP to see how to enable it.  You can&#8217;t get friendly URLs working without this!</li>
<li>Once you&#8217;ve confirmed that your .htaccess file is being parsed, you can make the appropriate edits (see below).  The dummy file included with your MODx install is very well annotated.  I&#8217;ve listed the most important bits below (please change <em>yourdomain</em> to the appropriate domain).  Note that in some of the lines, you must precede periods with a backslash (i.e. you must escape them).  Any line starting with &#8220;#&#8221; is a comment.<code><br />
# Vital components of your .htaccess file<br />
RewriteEngine On<br />
RewriteBase /</code></p>
<p># Force &#8220;www.yourdomain.com&#8221; instead of just &#8220;yourdomain.com&#8221;<br />
RewriteCond %{HTTP_HOST} .<br />
RewriteCond %{HTTP_HOST} !^www\.yourdomain\.com [NC]<br />
RewriteRule (.*) http://www.yourdomain.com/$1 [R=301,L]</p>
<p># The Friendly URLs part<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]</li>
<li>Make sure your site is still working&#8230; you can still use the same un-friendly URLs after making these edits; you just want to make sure you didn&#8217;t misspell something in your .htaccess file and cause it to parse incorrectly.</li>
<li>Login to the MODx manager (www.yoursite.com/manager) and go to <strong>Tools→Configuration→Friendly URLs</strong> and change the following settings:<br />
* Use friendly URLs: YES<br />
* Use friendly aliases: YES<br />
* Use friendly alias path: YES</li>
</ol>
<p>You should now be able to navigate to pages by using their alias!</p>
<h2>More Information</h2>
<p><a href="http://wiki.modxcms.com/index.php/Friendly_URLs_Guide">Friendly URLs Guide</a> &#8212; From the MODx Wiki.</p>
<h2>Technical Details about .htaccess</h2>
<p>What exactly is happening?  Well, the .htaccess file can control a lot of server settings, and you can think of it almost like a style sheet: the server has global settings, but the .htaccess file provides a way to override some of those settings locally for a particular directory or site.  It really merits its own article (stay tuned), but let&#8217;s look at the the friendly URLs part of the .htaccess file.</p>
<p>The core of this functionality is Apache&#8217;s <strong>mod_rewrite</strong> module.  My snarky description is this: <strong>it lets the server lie to your address bar! </strong> Your browser window may <em>SAY</em> that you are visiting <strong>www.mydomain.com/modx/tutorial</strong>, but really, the page you are viewing (on a MODx site) is:<br />
<strong>www.mydomain.com/index.php?q=modx/tutorial</strong><br />
Try this on your own MODx site!  You should see the same page as you did when you visited the friendly URL.</p>
<p>Here&#8217;s what the .htaccess file is doing.  The first RewriteCond is checking the file system for a file of the name you are requesting.  In the example, it&#8217;d look for a file named &#8220;tutorial&#8221; in the &#8220;modx&#8221; directory.  The &#8220;!-f&#8221; at the end of the line is basically saying &#8220;IF there isn&#8217;t a file of this name&#8221;&#8230; then the next line&#8217;s &#8220;!-d&#8221; says &#8220;OR there&#8217;s not a directory of this name&#8221;, THEN perform the rewrite defined by the RewriteRule.</p>
<p>Here you see a good example of a regular expression, and if you haven&#8217;t heard that term before, I can sum up quickly: if you&#8217;ve ever done a &#8220;search&#8221; or a &#8220;find and replace&#8221; in a document, you&#8217;ve utilized a simple type of regular expression.  A regular expression searches for a pattern.  The $1 is a common shorthand notation that back-references what exactly was found, in this case, it&#8217;s the argument that&#8217;s being passed to the server for the REQUEST_FILENAME, i.e. &#8220;modx/tutorial&#8221;.  The contents of the $1 variable is then added onto  &#8220;index.php?q=&#8221; and you end up with the REAL URL being:<br />
<strong>www.mydomain.com/index.php?q=modx/tutorial</strong></p>
<p>Tricky tricky!  I skipped over a lot of details for this brief overview, but hopefully you can see some of the process here.  This is how most CMS&#8217;s handle this sort of thing.  The .htaccess parsing requires more overhead from Apache, but it offers a lot of flexibility in how you access your files, and for most sites, this is a very worthy tradeoff.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://tipsfor.us/2009/01/27/installing-modx-modx-series-part-iii/" rel="bookmark" class="crp_title">Installing MODx (MODx Series Part III)</a></li><li><a href="http://tipsfor.us/2009/01/22/new-overview-of-modx-modx-series-part-ii/" rel="bookmark" class="crp_title">New Overview of MODx (MODx Series Part II)</a></li><li><a href="http://tipsfor.us/2009/04/30/creating-templates-in-modx-part-i-part-iv-in-the-series/" rel="bookmark" class="crp_title">Creating Templates in MODx Part I (part IV in the series)</a></li><li><a href="http://tipsfor.us/2009/05/01/creating-templates-in-modx-part-ii-part-v-in-the-series/" rel="bookmark" class="crp_title">Creating Templates in MODx Part II (part V in the series)</a></li><li><a href="http://tipsfor.us/2009/02/27/moving-wordpress-to-mediatemple-hosting/" rel="bookmark" class="crp_title">Moving Wordpress to MediaTemple Hosting</a></li></ul></div><p>Post from: <a href="http://www.tipsfor.us">TipsFor.us</a><br /><br/><br/><a href="http://tipsfor.us/2009/05/26/enabling-seo-friendly-urls-in-modx-part-vi-in-the-series/">Enabling SEO Friendly URLs in MODx (part VI in the series)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tipsfor.us/2009/05/26/enabling-seo-friendly-urls-in-modx-part-vi-in-the-series/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Creating Templates in MODx Part II (part V in the series)</title>
		<link>http://tipsfor.us/2009/05/01/creating-templates-in-modx-part-ii-part-v-in-the-series/</link>
		<comments>http://tipsfor.us/2009/05/01/creating-templates-in-modx-part-ii-part-v-in-the-series/#comments</comments>
		<pubDate>Fri, 01 May 2009 14:00:08 +0000</pubDate>
		<dc:creator>Everett - TipsFor.us</dc:creator>
				<category><![CDATA[MODx]]></category>

		<guid isPermaLink="false">http://www.tipsfor.us/?p=2158</guid>
		<description><![CDATA[<p>Now that you are able to create basic MODx templates from watching the previous video, this video shows you how to extend their functionality even further with the inclusion of reusable chunks of code and dynamic PHP snippets.</p>
<p>Click here to view the embedded video.</p>
Vocabulary
<p>You only have to learn a couple new terms to understand what [...]<p>Post from: <a href="http://www.tipsfor.us">TipsFor.us</a><br /><br/><br/><a href="http://tipsfor.us/2009/05/01/creating-templates-in-modx-part-ii-part-v-in-the-series/">Creating Templates in MODx Part II (part V in the series)</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Now that you are able to create basic MODx templates from watching the <a href="http://www.tipsfor.us/2009/04/30/creating-templates-in-modx-part-i-part-iv-in-the-series/">previous video</a>, this video shows you how to extend their functionality even further with the inclusion of reusable chunks of code and dynamic PHP snippets.</p>
<p><a href="http://tipsfor.us/2009/05/01/creating-templates-in-modx-part-ii-part-v-in-the-series/"><em>Click here to view the embedded video.</em></a></p>
<h2>Vocabulary</h2>
<p>You only have to learn a couple new terms to understand what MODx is talking about &#8212; it&#8217;s not a steep learning curve, so jump in!</p>
<ol>
<li><strong>Chunk</strong> &#8212; any bit of reusable text (usually HTML).  Text used in a site&#8217;s footer is commonly placed into a chunk.  MODx references chunks using double curly-braces: <strong>{{name_of_your_chunk}}</strong>, and they can be used almost anywhere, including page content and templates.  Chunks can also contain Snippets!</li>
<li><strong>Snippet</strong>&#8211; this is a bit of PHP code (I remember Snippet by its double-P&#8217;s: sni-<strong>PhP</strong>-et).  You can literally cut and paste almost any working PHP script into a MODx Snippet; once it has been created, you reference it using either double-square brackets or with a bracket and an exclamation point: <strong>[[Like_this]]</strong> or <strong>[!Like_this!]</strong>, depending on whether you want it to always execute, or whether its output can be cached.  See the <a href="http://wiki.modxcms.com/index.php/Snippets">MODx Wiki</a> for more information.</li>
</ol>
<h2>Clarification</h2>
<p>To clarify the process here, first you create a Chunk or a Snippet by logging into the MODx Manager and navigating to <strong>Resources→Manage Resources</strong>, then selecting the appropriate tab (for Snippet or for Chunk).  You paste in the code you want to use, then save it.  Back in your documents or templates, you can reference the Chunks and Snippets by name, flagging the names with either &#8220;{{ name }}&#8221; (for Chunks) or &#8220;[[ name ]]&#8221; (for Snippets).  When MODx parses the document or template, the text in the Chunk will replace the tag, or in the case of a Snippet, the code will execute and its output will replace the tag.</p>
<h2>Template Tips</h2>
<ol>
<li>If you keep pasting the same bit of text into lots and lots of pages, consider adding that text into a Chunk.  Also consider adding the reference to that chunk to your template.</li>
<li>Set up a good working Snippet to auto-generate your menus.  <a href="http://www.muddydogpaws.com/development/wayfinder/features.html">Wayfinder</a> is a very flexible Snippet designed explicitly for this task, and it is included with MODx.  Check the <a href="http://www.muddydogpaws.com/development/wayfinder/features.html">official site</a> for up-to-date documentation; there are also lots of examples on the <a href="http://wiki.modxcms.com/index.php/Wayfinder">MODx Wiki</a></li>
<li>Plan your site and its templates before trying to code them; then make sure you code them before adding them to MODx.</li>
<li>If your site has too many templates, you probably are doing something inefficiently.  Ask around: is there a better way to accomplish what you&#8217;re trying to do?</li>
<li>When adding your templates and its associated chunks/snippets to MODx, take advantage of the &#8220;category&#8221; field. It offers a simple way to keep your components organized.</li>
</ol>
<h2>Other Tutorials: don&#8217;t just take our word for it</h2>
<ol>
<li><a href="http://nettuts.com/tutorials/other/working-with-a-content-management-framework-modx/">Net tuts</a></li>
<li><a href="http://bobsguides.com/porting-your-site-to-modx.html">Bob&#8217;s Guides</a> &#8212; Bob is very active in the <a href="http://modxcms.com/forums/">MODx Forums</a>, and he knows what he&#8217;s talking about.</li>
<li><a href="http://codingpad.maryspad.com/2009/03/31/building-a-website-with-modx-for-newbies-part-3-working-with-templates/">The Coding Pad</a></li>
</ol>
<h2>Download MODx Templates</h2>
<p>You can also download MODx templates from a number of other sites!  And since it&#8217;s so easy to integrate existing templates, you can download templates for virtually any platform and incorporate them into MODx.</p>
<ul>
<li><a href="http://modxcms.com/extras.html?view=repository/view&amp;repository=11">MODxCMS</a> &#8212; the official repository</li>
<li><a href="http://www.tattoocms.it/">http://www.tattoocms.it/</a></li>
<li><a href="http://www.free-css.com/search.php">http://www.free-css.com/search.php</a></li>
<li><a href="http://www.modxhost.com/templates/full-sites.html">http://www.modxhost.com/templates/full-sites.html</a></li>
</ul>
<h2>Summary</h2>
<p>After watching these two videos, I hope you can see how simple it is to get CMS functionality out of existing HTML/CSS using MODx.  Again, the big thing I didn&#8217;t explicitly point out in the videos is that MODx stores its template code in its database: you can create and use a MODx template without uploading a single file to your webserver.  Of course, if you want to reference CSS or Javascript files on your webserver, it&#8217;s accomplished in exactly the same way as you would do it on a static site: just make sure your paths to your resources are correct.  I&#8217;ll cover how to write your own Snippets in another video.  For now, just review the wiki page about <a href="http://wiki.modxcms.com/index.php/Placeholders_used_by_MODx_Pages_and_Templates">MODx placeholders</a> as you build your own templates.  Please note, I did make one slip up in the video&#8230; Snippet values should usually include backticks, like this: [[MySnippet? &amp;parameter1=`value`]].</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://tipsfor.us/2009/04/30/creating-templates-in-modx-part-i-part-iv-in-the-series/" rel="bookmark" class="crp_title">Creating Templates in MODx Part I (part IV in the series)</a></li><li><a href="http://tipsfor.us/2009/01/27/installing-modx-modx-series-part-iii/" rel="bookmark" class="crp_title">Installing MODx (MODx Series Part III)</a></li><li><a href="http://tipsfor.us/2009/11/02/writing-custom-php-snippets-for-modx-part-vii/" rel="bookmark" class="crp_title">Writing Custom PHP Snippets for MODx (part VII)</a></li><li><a href="http://tipsfor.us/2009/01/22/new-overview-of-modx-modx-series-part-ii/" rel="bookmark" class="crp_title">New Overview of MODx (MODx Series Part II)</a></li><li><a href="http://tipsfor.us/2008/09/08/content-management-systems-cms/" rel="bookmark" class="crp_title">Content Management Systems (CMS)</a></li></ul></div><p>Post from: <a href="http://www.tipsfor.us">TipsFor.us</a><br /><br/><br/><a href="http://tipsfor.us/2009/05/01/creating-templates-in-modx-part-ii-part-v-in-the-series/">Creating Templates in MODx Part II (part V in the series)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tipsfor.us/2009/05/01/creating-templates-in-modx-part-ii-part-v-in-the-series/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Creating Templates in MODx Part I (part IV in the series)</title>
		<link>http://tipsfor.us/2009/04/30/creating-templates-in-modx-part-i-part-iv-in-the-series/</link>
		<comments>http://tipsfor.us/2009/04/30/creating-templates-in-modx-part-i-part-iv-in-the-series/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 14:00:35 +0000</pubDate>
		<dc:creator>Everett - TipsFor.us</dc:creator>
				<category><![CDATA[MODx]]></category>

		<guid isPermaLink="false">http://www.tipsfor.us/?p=2149</guid>
		<description><![CDATA[<p>I&#8217;m continuing my series of hi-res videos of the MODx content management system, this time I&#8217;m stepping through how you can easily take existing HTML and CSS layouts and adapt them for use with MODx.  For my example, I take Eric Meyer&#8217;s &#8220;Complex Spiral&#8221; demo and within a few minutes, I have it adapted [...]<p>Post from: <a href="http://www.tipsfor.us">TipsFor.us</a><br /><br/><br/><a href="http://tipsfor.us/2009/04/30/creating-templates-in-modx-part-i-part-iv-in-the-series/">Creating Templates in MODx Part I (part IV in the series)</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m continuing my series of hi-res videos of the <a href="http://modxcms.com/">MODx</a> content management system, this time I&#8217;m stepping through how you can easily take existing HTML and CSS layouts and adapt them for use with MODx.  For my example, I take Eric Meyer&#8217;s &#8220;<a href="http://meyerweb.com/eric/css/edge/complexspiral/glassy.html">Complex Spiral</a>&#8221; demo and within a few minutes, I have it adapted for use with my site.</p>
<p>It&#8217;s an exciting time to be writing about this platform: the <a href="http://www.tipsfor.us/r/amazon.php?asin=1847194907">first book about MODx</a> was published by Packt Publishing, and we anticipate the release of their &#8220;2.0&#8243; version (dubbed &#8220;Revolution&#8221;) later this year.</p>
<p><a href="http://tipsfor.us/2009/04/30/creating-templates-in-modx-part-i-part-iv-in-the-series/"><em>Click here to view the embedded video.</em></a></p>
<p>I include the image below as a quick reference for the placeholder tags used by MODx.  Refer to the <a href="http://wiki.modxcms.com/index.php/Placeholders_used_by_MODx_Pages_and_Templates">wiki page</a> for a more complete list.</p>
<div id="attachment_1730" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.tipsfor.us/wp-content/uploads/2009/01/placeholder-legend.jpg"><img class="size-full wp-image-1730" title="placeholder-legend" src="http://www.tipsfor.us/wp-content/uploads/2009/01/placeholder-legend.jpg" alt="MODx uses simple placeholders for templates" width="500" height="440" /></a><p class="wp-caption-text">MODx uses simple placeholders for templates</p></div>
<h2>Summary: Creating a Custom MODx Template</h2>
<ol>
<li><strong>Create a working HTML/CSS/Javascript web page.</strong> Make sure it works!</li>
<li><strong>Upload the template files to your web server (e.g. CSS, Javascript).</strong> Note that the actual <em>template code will live in the MODx database, not on the file system</em>, but you do upload the related assets to your webserver.  The recommended location for assets is in a dedicated folder in <em>/assets/templates</em> &#8212; make sure that you update your image paths or Javascript paths so that a page at the root of the site can safely reference the assets contained in the <em>/assets/templates/name_of_your_template</em> folder.<br/><em>* In the video, I upload the HTML file too just as a final check to make sure it works in the new location.</em></li>
<li><strong>Replace appropriate areas of your HTML with MODx placeholders.</strong> Refer to the image above or to the wiki page so you know which placeholders are available.</li>
<li><strong>Login to the MODx Manager, create a new template in Resources&rarr;Manage Resources&rarr;Templates</strong>.  Be sure to save it and give it a good name.</li>
<li><strong>Edit a page and choose to use the new template, and save the page!</strong> In other words, you need to tell your MODx documents to use your new template.</li>
</ol>
<div id="attachment_2168" class="wp-caption alignleft" style="width: 594px"><img src="http://www.tipsfor.us/wp-content/uploads/2009/04/modx-template-creation.jpg" alt="You upload the template code to the database, but it still can reference files on the webserver" title="Creating a MODx Template" width="584" height="474" class="size-full wp-image-2168" /><p class="wp-caption-text">You upload the template code to the database, but it still can reference files on the webserver</p></div>
<h2>Clarifications</h2>
<p>MODx handles templates differently than some CMS&#8217;s, and I didn&#8217;t point this out in the video.  A MODx template lives in the MODx database.  You cut and paste the HTML into the MODx manager <strong>Resources&#8211;>Manage Resources&#8211;>Templates</strong>.  Even though your template code lives in the database, it can still reference files on the web server.  For example, if you upload your CSS and Javascript files to <strong>/assets/templates/my_template/</strong>, then your HTML should use paths like <strong>href=&#8221;/assets/templates/my_template/style.css&#8221;</strong>.</p>
<h2>Keep Watching&#8230;</h2>
<p><a href="http://www.tipsfor.us/2009/05/01/creating-templates-in-modx-part-ii-part-v-in-the-series/">Part two</a> of this video shows how to add Chunks and Snippets to your template for more dynamic functionality.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://tipsfor.us/2009/05/01/creating-templates-in-modx-part-ii-part-v-in-the-series/" rel="bookmark" class="crp_title">Creating Templates in MODx Part II (part V in the series)</a></li><li><a href="http://tipsfor.us/2009/01/22/new-overview-of-modx-modx-series-part-ii/" rel="bookmark" class="crp_title">New Overview of MODx (MODx Series Part II)</a></li><li><a href="http://tipsfor.us/2009/01/27/installing-modx-modx-series-part-iii/" rel="bookmark" class="crp_title">Installing MODx (MODx Series Part III)</a></li><li><a href="http://tipsfor.us/2008/09/08/content-management-systems-cms/" rel="bookmark" class="crp_title">Content Management Systems (CMS)</a></li><li><a href="http://tipsfor.us/2009/11/02/writing-custom-php-snippets-for-modx-part-vii/" rel="bookmark" class="crp_title">Writing Custom PHP Snippets for MODx (part VII)</a></li></ul></div><p>Post from: <a href="http://www.tipsfor.us">TipsFor.us</a><br /><br/><br/><a href="http://tipsfor.us/2009/04/30/creating-templates-in-modx-part-i-part-iv-in-the-series/">Creating Templates in MODx Part I (part IV in the series)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tipsfor.us/2009/04/30/creating-templates-in-modx-part-i-part-iv-in-the-series/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Installing MODx (MODx Series Part III)</title>
		<link>http://tipsfor.us/2009/01/27/installing-modx-modx-series-part-iii/</link>
		<comments>http://tipsfor.us/2009/01/27/installing-modx-modx-series-part-iii/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 14:00:35 +0000</pubDate>
		<dc:creator>Everett - TipsFor.us</dc:creator>
				<category><![CDATA[MODx]]></category>

		<guid isPermaLink="false">http://www.tipsfor.us/?p=1698</guid>
		<description><![CDATA[<p>Here&#8217;s a video of me installing the MODx content management system.  In case it wasn&#8217;t clear why I was doing this series, I REALLY like MODx and I find it the easiest CMS to work with both as a PHP developer and as a front-end designer.  The video is my small contribution to [...]<p>Post from: <a href="http://www.tipsfor.us">TipsFor.us</a><br /><br/><br/><a href="http://tipsfor.us/2009/01/27/installing-modx-modx-series-part-iii/">Installing MODx (MODx Series Part III)</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a video of me installing the MODx content management system.  In case it wasn&#8217;t clear why I was doing this series, I REALLY like MODx and I find it the easiest CMS to work with both as a PHP developer and as a front-end designer.  The video is my small contribution to make it easier to install this nifty CMS, and sometimes less is more.  There are already a lot of high quality resources available for anyone who wants to try out this CMS.  See the references below.</p>
<p><a href="http://tipsfor.us/2009/01/27/installing-modx-modx-series-part-iii/"><em>Click here to view the embedded video.</em></a></p>
<h2>References</h2>
<p>There are already a lot of resources available to help people install MODx.  Here is a list of what I feel are the most useful:</p>
<p><strong>Download MODx here:</strong> <a href="http://modxcms.com/downloads.html">http://modxcms.com/downloads.html</a> (obviously, you need to be able to download it before you do anything else)</p>
<p><strong>Official Documentation:</strong> <a href="http://modxcms.com/installation-and-configuration.html">http://modxcms.com/installation-and-configuration.html</a></p>
<p><strong>Wiki:</strong> It&#8217;s a wonderful resource with a whole section for installation. <a href="http://wiki.modxcms.com/index.php/Category:Installation">http://wiki.modxcms.com/index.php/Category:Installation</a></p>
<p><strong>Bob&#8217;s Guides</strong>: <a href="http://bobsguides.com/installing-modx.html">http://bobsguides.com/installing-modx.html</a> &#8212; Bob is very active in the MODx forums and he knows what he&#8217;s talking about.</p>
<h2>Bits of Wisdom</h2>
<ul>
<li><strong>Write down your database name, user, and password.</strong> These are the 3 keys to the kingdom that many CMS applications depend on.  If you ever forget a password or get into some sort of trouble with the app, you&#8217;ll need this information.  I recommend storing it in a safe place, as discussed by one of our previous articles on <a href="/2008/09/20/keepass-never-remember-a-password-again/">KeePass</a></li>
<li><strong>Install the Sample Web Site.</strong> Yes, if it&#8217;s your first time, you can learn a lot by looking through how the sample site works.  Go ahead and break it.  Demolish it.  It&#8217;s really easy to install it again.</li>
<li><strong>Visit the Wiki.</strong> Some people (including myself) have spent hours creating pages with details and instructions for overcoming a number of problems. The MODx Wiki lives <a href="http://wiki.modxcms.com/index.php/Main_Page">here</a>.</li>
</ul>
<h2>Problems Installing MODx</h2>
<p>Nearly all the problems I&#8217;ve had in the 20 or 30 MODx installations that I&#8217;ve done have stemmed from webserver permissions.  Basically, Apache needs to be able read every file and write to certain directories.  MODx is very verbose about which files and directories it wants to see, so this is usually easy to fix.</p>
<p>The other problems I&#8217;ve run into have only been on dedicated servers that I setup.  I&#8217;m not a Linux guru (well, except in those really wild fantasies where I&#8217;m on a Lear jet with scantily clad foreign courtesans), so some of these &#8220;problems&#8221; are more like &#8220;no-sh*t-Sherlock&#8221; annoyances for those with more experience, but they&#8217;ve boiled down to simply installing the correct PHP modules.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://tipsfor.us/2009/05/01/creating-templates-in-modx-part-ii-part-v-in-the-series/" rel="bookmark" class="crp_title">Creating Templates in MODx Part II (part V in the series)</a></li><li><a href="http://tipsfor.us/2009/04/30/creating-templates-in-modx-part-i-part-iv-in-the-series/" rel="bookmark" class="crp_title">Creating Templates in MODx Part I (part IV in the series)</a></li><li><a href="http://tipsfor.us/2009/01/22/new-overview-of-modx-modx-series-part-ii/" rel="bookmark" class="crp_title">New Overview of MODx (MODx Series Part II)</a></li><li><a href="http://tipsfor.us/2009/05/26/enabling-seo-friendly-urls-in-modx-part-vi-in-the-series/" rel="bookmark" class="crp_title">Enabling SEO Friendly URLs in MODx (part VI in the series)</a></li><li><a href="http://tipsfor.us/2009/11/02/writing-custom-php-snippets-for-modx-part-vii/" rel="bookmark" class="crp_title">Writing Custom PHP Snippets for MODx (part VII)</a></li></ul></div><p>Post from: <a href="http://www.tipsfor.us">TipsFor.us</a><br /><br/><br/><a href="http://tipsfor.us/2009/01/27/installing-modx-modx-series-part-iii/">Installing MODx (MODx Series Part III)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tipsfor.us/2009/01/27/installing-modx-modx-series-part-iii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Overview of MODx (MODx Series Part II)</title>
		<link>http://tipsfor.us/2009/01/22/new-overview-of-modx-modx-series-part-ii/</link>
		<comments>http://tipsfor.us/2009/01/22/new-overview-of-modx-modx-series-part-ii/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 14:00:53 +0000</pubDate>
		<dc:creator>Everett - TipsFor.us</dc:creator>
				<category><![CDATA[MODx]]></category>

		<guid isPermaLink="false">http://www.tipsfor.us/?p=1700</guid>
		<description><![CDATA[<p>A while back I did a brief overview of the MODx content management system.  Well, I was asked to do a high-resolution video so you can see what the manager interface looks like and you can get an idea of why you might want to choose the MODx content management system for your next [...]<p>Post from: <a href="http://www.tipsfor.us">TipsFor.us</a><br /><br/><br/><a href="http://tipsfor.us/2009/01/22/new-overview-of-modx-modx-series-part-ii/">New Overview of MODx (MODx Series Part II)</a></p>
]]></description>
			<content:encoded><![CDATA[<p>A while back I did a brief overview of the MODx content management system.  Well, I was asked to do a high-resolution video so you can see what the manager interface looks like and you can get an idea of why you might want to choose the <a href="http://modxcms.com/">MODx content management system</a> for your next web site.</p>
<p><a href="http://tipsfor.us/2009/01/22/new-overview-of-modx-modx-series-part-ii/"><em>Click here to view the embedded video.</em></a></p>
<h3>Overview</h3>
<p>Publish/unpublish a document by right-clicking the document:</p>
<div id="attachment_1726" class="wp-caption aligncenter" style="width: 318px"><img class="size-full wp-image-1726" title="ajax-edit" src="http://www.tipsfor.us/wp-content/uploads/2009/01/ajax-edit.jpg" alt="Right-click a document to edit it" width="308" height="481" /><p class="wp-caption-text">Right-click a document to edit it</p></div>
<p>You can set publish/unpublish dates by changing the Page Settings:</p>
<div id="attachment_1727" class="wp-caption aligncenter" style="width: 510px"><img class="size-full wp-image-1727" title="publish_unpublish-dates" src="http://www.tipsfor.us/wp-content/uploads/2009/01/publish_unpublish-dates.jpg" alt="Set the Publish/Unpublish dates in the Page Settings tab" width="500" height="315" /><p class="wp-caption-text">Set the Publish/Unpublish dates in the Page Settings tab</p></div>
<p>Build your own templates or use existing CSS and HTML by adding simple placeholders to the code.  Just paste the HTML page into a new Template.</p>
<p><strong>Sample of a MODx Template:</strong></p>
<div style="border: 1px solid black; padding: 10px; background-color: #C0C0C0;"><code><br />
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;<br />
&lt;head&gt;<br />
&lt;title&gt;[*pagetitle*]&lt;/title&gt;<br />
&lt;meta name="description" content="[*description*]"&gt;<br />
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;<br />
&lt;link type="text/css" media="screen" rel="stylesheet" href="/assets/templates/uncomplicated/style.css" /&gt;<br />
&lt;base href="/"/&gt;<br />
&lt;/head&gt;<br />
&lt;body&gt;<br />
&lt;h1&gt;[*longtitle*]&lt;/h1&gt;<br />
[*content*]</code></div>
<p>Where you put the [*placeholders*] is somewhat arbitrary, but the above example is how I usually put together my templates.  It&#8217;s just important to remember how the substitution works.  The text in the &#8220;Title&#8221; field will replace the [*pagetitle*] placeholder tag.</p>
<p>Here&#8217;s a graphic I made to demonstrate how the values in the editor are substituted any instances of the placeholders in the template.  MODx offers the easiest templating I know of.  Stay tuned for a hi-res video illustrating how you can take an existing HTML/CSS layout and turn it into a MODx template&#8230; for now, only the <a href="http://www.youtube.com/watch?v=EasmxiU0LsM">low-res</a> video is available.</p>
<div id="attachment_1730" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.tipsfor.us/wp-content/uploads/2009/01/placeholder-legend.jpg"><img class="size-full wp-image-1730" title="placeholder-legend" src="http://www.tipsfor.us/wp-content/uploads/2009/01/placeholder-legend.jpg" alt="MODx uses simple placeholders for templates" width="500" height="440" /></a><p class="wp-caption-text">MODx uses simple placeholders for templates</p></div>
<p>MODx also allows you to add custom fields to any document, but that&#8217;s a more advanced topic&#8230; stay tuned.</p>
<h3>Requirements</h3>
<p>The requirements for MODx are quite similar to the requirements of other CMS&#8217;s.</p>
<ul>
<li>PHP (4.4.x or above)</li>
<li>MySQL (4.1 or above)</li>
<li>Apache with mod_rewrite (used for friendly URLs)</li>
</ul>
<h3>Advantages</h3>
<ul>
<li>&#8211; <strong>Document Tree</strong>.  Using other CMS&#8217;s it can be difficult to locate content.  &#8220;Where was that legal notice?  I know the URL, but I just can&#8217;t find the content to edit it!&#8221;  MODx makes it easy to find and edit your content.</li>
<li>&#8211; <strong>Isolation of Responsibilities</strong>. It&#8217;s very simple to isolate roles so a team can work on a site: content folks can login to the manager and edit content, front-end designers can build HTML and CSS templates that integrate <em>EASILY</em> into MODx without a steep learning curve, and PHP developers can write code, and each of these separate groups can work in their respective areas with very simple overlaps.</li>
<li>&#8211; <strong>Simple Templates</strong>.  There are no special logical tags to learn for templates; PHP scripts can be saved directly in the database and called from any document.  Not all CMS&#8217;s provide this kind of isolation, and no other CMS makes it as easy to use existing HTML and CSS layouts.</li>
<li>&#8211; <strong>Dynamic Menus</strong>. They make it easy to move content around your site, and menus will generate themselves automatically!</li>
<li>&#8211; <strong>Speed</strong>.  All CMS&#8217;s are slower than a static site, but MODx is one of the faster CMS&#8217;s that I&#8217;ve seen using <a href="http://websiteoptimization.com/services/analyze/">load time benchmarking</a>.</li>
<li>&#8211; <strong>Small database footprint</strong>.  You can get a hundred pages on your site and end up using only a few megabytes in your database.  Other CMS&#8217;s use much more space in the database.</li>
<li>&#8211; <strong>Extendable!</strong> It is insanely simple to add existing PHP scripts to MODx.</li>
</ul>
<h3>Limitations</h3>
<p>As much as I like MODx, it may not be the best choice for your particular needs.</p>
<ul>
<li>&#8211; <strong>5000 page limit</strong>.  The new version of MODx will support more, but if you have more than 5000 pages on your site, MODx may not be for you.  There are work-arounds, however&#8230;</li>
<li>&#8211; <strong>Open-Source</strong>.  If you are in a corporate environment and you NEED to have someone on-call for help resolving technical problems, then you should probably look for a different CMS.  MODx is open-source.  The forums are a great place to get help, but there is no dedicated support staff.</li>
<li>&#8211; <strong>Versioning</strong>.  Some CMS&#8217;s offer rollback features for the content in your templates or posts (similar to giving you levels of &#8220;un-do&#8221;), but the current version (0.9.6.3) does not offer this by default.  You can add this functionality, but it is not built-in; it is slated to be included in the next version of MODx</li>
</ul>
<h3>Summary</h3>
<p>I hope that the video gives you an idea of what this content management system looks like.  Hopefully you can see how you might use it for one of your own projects.  Don&#8217;t forget the <a href="http://wiki.modxcms.com/index.php/Main_Page">MODx Wiki</a> and the <a href="http://modxcms.com/forums/">MODx forums</a> for additional resources.  Stay tuned for more videos.</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://tipsfor.us/2009/04/30/creating-templates-in-modx-part-i-part-iv-in-the-series/" rel="bookmark" class="crp_title">Creating Templates in MODx Part I (part IV in the series)</a></li><li><a href="http://tipsfor.us/2009/05/01/creating-templates-in-modx-part-ii-part-v-in-the-series/" rel="bookmark" class="crp_title">Creating Templates in MODx Part II (part V in the series)</a></li><li><a href="http://tipsfor.us/2008/09/08/content-management-systems-cms/" rel="bookmark" class="crp_title">Content Management Systems (CMS)</a></li><li><a href="http://tipsfor.us/2009/01/13/content-management-systems-prelude-to-modx-part-i/" rel="bookmark" class="crp_title">Content Management Systems (Prelude to MODx): Part I</a></li><li><a href="http://tipsfor.us/2009/01/27/installing-modx-modx-series-part-iii/" rel="bookmark" class="crp_title">Installing MODx (MODx Series Part III)</a></li></ul></div><p>Post from: <a href="http://www.tipsfor.us">TipsFor.us</a><br /><br/><br/><a href="http://tipsfor.us/2009/01/22/new-overview-of-modx-modx-series-part-ii/">New Overview of MODx (MODx Series Part II)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tipsfor.us/2009/01/22/new-overview-of-modx-modx-series-part-ii/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Content Management Systems (Prelude to MODx): Part I</title>
		<link>http://tipsfor.us/2009/01/13/content-management-systems-prelude-to-modx-part-i/</link>
		<comments>http://tipsfor.us/2009/01/13/content-management-systems-prelude-to-modx-part-i/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 14:00:05 +0000</pubDate>
		<dc:creator>Everett - TipsFor.us</dc:creator>
				<category><![CDATA[MODx]]></category>
		<category><![CDATA[Nerd Stuff]]></category>

		<guid isPermaLink="false">http://www.tipsfor.us/?p=1645</guid>
		<description><![CDATA[Introduction to Web Sites, CMS&#8217;s, and MODx
<p class="wp-caption-text">MODx lets you take control...</p>
<p>Some of you may remember the little article I wrote a while ago about content management systems where I shared a bit about MODx.  What is MODx? (pronounced like &#8220;modular&#8221;&#8230; and it&#8217;s eXtendable&#8230; get it?)  It&#8217;s a content management system (CMS), and [...]<p>Post from: <a href="http://www.tipsfor.us">TipsFor.us</a><br /><br/><br/><a href="http://tipsfor.us/2009/01/13/content-management-systems-prelude-to-modx-part-i/">Content Management Systems (Prelude to MODx): Part I</a></p>
]]></description>
			<content:encoded><![CDATA[<h2>Introduction to Web Sites, CMS&#8217;s, and MODx</h2>
<div id="attachment_1646" class="wp-caption aligncenter" style="width: 310px"><a href="http://modxcms.com/"><img class="size-medium wp-image-1646" title="takecontrol" src="http://www.tipsfor.us/wp-content/uploads/2009/01/takecontrol-300x97.jpg" alt="MODx lets you take control..." width="300" height="97" /></a><p class="wp-caption-text">MODx lets you take control...</p></div>
<p>Some of you may remember the little article I wrote a while ago about <a href="http://www.tipsfor.us/2008/09/08/content-management-systems-cms/">content management systems</a> where I shared a bit about MODx.  What is MODx? (pronounced like &#8220;modular&#8221;&#8230; and it&#8217;s eXtendable&#8230; get it?)  It&#8217;s a content management system (CMS), and it&#8217;s used to help you manage and publish web sites easily.  It&#8217;s very cool, and it is very flexible&#8230; but I&#8217;m getting ahead of myself.   I want to spend some time with our readers and talk a bit about web sites and CMS&#8217;s and use that discussion to segue into an upcoming video series about MODx.  If you already know what MODx is and you want to learn about it, stay tuned for the upcoming videos&#8230; if you want to read a nice walk-through, check out <a href="http://nettuts.com/tutorials/other/working-with-a-content-management-framework-modx/">NetTuts</a> recent article.</p>
<h2>Web Sites 101</h2>
<p>If you&#8217;re reading this, you should have some idea of how this is happening&#8230; in the interest of the stringent word count limitations imposed by&#8230; uh&#8230; Brian (?)&#8230; I&#8217;m going to assume that you understand the concepts of a domain name, a web server, and how a traditional request such as &#8220;http://www.tipsfor.us/some_page.html&#8221; is handled and a page is read and returned to your browser.  You with me?  Great.</p>
<h2>Higher Education: Dynamic Web Sites</h2>
<p>A static site grabs a file from a folder and displays it to the browser, whereas a dynamic site operates a bit more like the &#8220;printing on demand&#8221; technology.  Many sites (including this one) rely on dynamic technology to serve up a page&#8230; the page that you are requesting may not even exist until you request it.  The &#8220;page&#8221; that you end up reading is often assembled on the fly from a series of scripts and bits of text from the file system and/or from a database.</p>
<h2>Making Web Sites: The Perils of Static Sites</h2>
<div id="attachment_1648" class="wp-caption aligncenter" style="width: 508px"><img class="size-full wp-image-1648" title="train_wreck" src="http://www.tipsfor.us/wp-content/uploads/2009/01/train_wreck.jpg" alt="Coding Sites by Hand is Perilous" width="498" height="295" /><p class="wp-caption-text">Coding Sites by Hand is Perilous</p></div>
<p>We all start out bald and naked, filling diapers and making static web sites.  As you get older, you learn a little more HTML, and your &#8220;&lt;h1&gt;Hello World&lt;/h1&gt;&#8221; progresses to animated GIFs and maybe some CSS and Javascript, but some people take a long time to mature out of static web development.  And not unlike growing up and leaving home, there&#8217;s a profound turning point in your web education that propels you out of static land.  Let&#8217;s say you want to change the name of one of your pages from &#8220;articles/cool-stuff.html&#8221; to &#8220;articles/archive/cool-stuph.html&#8221;.  You have to move the document and change its file name, then you have to wade through all the pages on your site and update any links or menus.  It&#8217;s only palatable if you have a few pages.  If you have more than 10 or so, this scenario quickly becomes cumbersome and prone to error&#8230; you&#8217;ll be wanting to ask mom to do your laundry.</p>
<p>Another not-so-hypothetical situation arises when you want to change the look and feel of your static site.  If you&#8217;ve followed the rules of semantic web development, you&#8217;ve separated your content from its formatting using CSS files and well formed HTML (check out <a href="http://www.csszengarden.com/">CSS Zen Garden</a>), but it can still be tricky if you&#8217;ve got to change Javascript files to make menus work.  And you still have to know a lot about HTML and FTP logins to make these changes.</p>
<h2>Enter Content Management Systems</h2>
<p>If your own learning curve of web site development has roughly followed the previous descriptions, then you can appreciate that someone found a better way to do things.  You can have your cake and eat it too.</p>
<h3>Benefits to using a CMS</h3>
<ul>
<li>&#8211; Isolates content from formatting (it&#8217;s much easier to search content and update templates)</li>
<li>&#8211; Editing content is easily done via a GUI</li>
<li>&#8211; Roles and permissions can be established: e.g. an editor, an admin, a blogger all can be allowed to do certain things to a site.</li>
<li>&#8211; Links between documents can update automatically (with most CMS&#8217;s)</li>
</ul>
<p>A CMS allows you to forgo the FTP client and use a front-end interface so that users can edit documents and templates.  A CMS usually has editing tools built right in, so you don&#8217;t even need to know HTML to edit the content of a page &#8212; this is great if you&#8217;ve built a site for someone else.  You can be the HTML genius, but you can give them the key to the CMS and they can edit and add content all day long.   Finally, a CMS provides the ultimate separation between content and its formatting.  This means that the text of an article can be fully isolated from the template used to display that article, and then the task of switching layouts for an entire site of thousands of pages becomes a trivial affair.  Changing the &#8220;location&#8221; of a file or its name is also dynamically rendered so it can be done in an instant.  These are the benefits to running a site using a CMS.</p>
<h3>Down Sides to CMS</h3>
<ul>
<li>&#8211; Complicated to set up.  Math is hard!  Let&#8217;s go to the mall!</li>
<li>&#8211; It&#8217;s more resource intensive.  Serving up flat files is much easier for the web server.</li>
<li>&#8211; More complicated server requirements: not all hosts will have a scripting language and database available to you.</li>
<li>&#8211; More bandwidth is required.</li>
</ul>
<p>A site running a CMS is almost never as responsive as a site simply serving up static files. A CMS has many more moving parts, so it&#8217;s more likely to break or be attacked.  You can&#8217;t do much to thwart the display of a simple HTML file, but you can experience all kinds of malicious attacks on a database an your scripting language of choice.</p>
<p>In my opinion, in most circumstances, the benefits often <em>far</em> outweigh the drawbacks.  You make some extra backups, you take a few extra precautions, and bamm&#8230; you can be pimping out your web site in CMS style, and once you&#8217;ve done it that way, you&#8217;ll never go back.</p>
<p>So now you know why you might want to use a CMS for web site development.  In the next article, I&#8217;ll discuss why you might want to choose MODx over some of many other systems available.  Lots of systems will alleviate some of the pain and stress of static development, but not all Content Management Systems are created equally.  The dudes working hard on MODx have made a really cool application that makes life so much easier for developers and content editors, and one of the founders asked me to upload some high resolution videos about it.  Thanks guys.  Stay tuned&#8230;</p>
<div id="crp_related"><h3>Related Posts:</h3><ul><li><a href="http://tipsfor.us/2008/09/08/content-management-systems-cms/" rel="bookmark" class="crp_title">Content Management Systems (CMS)</a></li><li><a href="http://tipsfor.us/2009/01/22/new-overview-of-modx-modx-series-part-ii/" rel="bookmark" class="crp_title">New Overview of MODx (MODx Series Part II)</a></li><li><a href="http://tipsfor.us/2009/05/01/creating-templates-in-modx-part-ii-part-v-in-the-series/" rel="bookmark" class="crp_title">Creating Templates in MODx Part II (part V in the series)</a></li><li><a href="http://tipsfor.us/2009/04/30/creating-templates-in-modx-part-i-part-iv-in-the-series/" rel="bookmark" class="crp_title">Creating Templates in MODx Part I (part IV in the series)</a></li><li><a href="http://tipsfor.us/2009/05/26/enabling-seo-friendly-urls-in-modx-part-vi-in-the-series/" rel="bookmark" class="crp_title">Enabling SEO Friendly URLs in MODx (part VI in the series)</a></li></ul></div><p>Post from: <a href="http://www.tipsfor.us">TipsFor.us</a><br /><br/><br/><a href="http://tipsfor.us/2009/01/13/content-management-systems-prelude-to-modx-part-i/">Content Management Systems (Prelude to MODx): Part I</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tipsfor.us/2009/01/13/content-management-systems-prelude-to-modx-part-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->