I used to be into Python/Ruby via command line MVC programming.
I know in the future modx elements will be able to be static so I can edit snippets through vim and such (can you tell I like the command line! : ) )
Anyway - is there a way right now where in php scripts I can include the modx class/classes -basically I need to build and run a snippet outside of the manager
I’m thinking I just make a php file and include the nessicary classes so I can do things like modx->getCollectionI() and such.....
Is there a list of classes - or class (maybe jus the modx class) I should include ?
Modx is amazing for end users - and great for quick programming - but some sites need heavy programming and i’m used to doing it via command line.
Generally, all you need is this (after defining MODX_CORE_PATH):
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
$modx= new modX();
$modx->initialize('mgr');
Note, though, that you can also keep all snippet code in files and just create a "shell" snippet in the Manager with:
<?php
return include "path_to_snippet_file";
?>
That way, you can edit the snippet code in your favorite editor and still test it inside MODx, which is often more practical.