Navigation
Getting ready
Before we get started you will need to have your site on some kind of version control system.
How to do it...
1. Create a static resource point the 'static resource' attribute to a file in your file system
2. For elements you will need to use the 'IncludeFile' snippet featured below. Example code:
How it works...
Resources and Elements containing HTML and PHP, can consist of When working in large applications in teams, it can be vital to integrate version control of the file system. In this manner changes invoked can be reverted to a previous state. Care must be taken in performing these kinds of operations for obvious reasons.
In your Resources panel click 'Add Static Resource'. Select the resource accordingly from your file system. The file can consist of HTML and MODx tags, and any other content that a Document is to consist of. When making changes to the file, that particular version can be committed.
In your Elements panel, create a Snippet called 'IncludeFile' and insert the below snippet of code.
if (!file_exists($file)) return '';
$o = include $file;
return $o;
Typically you would reference your snippet as such:
In addition to this call, we will also need to point the Snippet to a file. We will do this by assigning a parameter. An example call might look like:
The tag will work fine if you wish to insert a space delimiter before the ampersand for clarity. Make sure to use the back-tick and not the apostrophe.
Creating a Static Resource: