Hi folks,
A few years ago I created a website using mostly HTML with parts of it written in PHP so I can access and display data from a mySQL database.
My client has asked me to set up a CMS so they can update the content of the site themselves. My question is - can modX Revo be configured to connect to external data sources for parts of the website content ?
I have been doing some tutorials that shows me how to set up templates and how to use template variables etc but I have not found any material on the above subject.
Can anyone point me in the right direction (if it can be done)?
Thanks
-
☆ A M B ☆
- 1,780 Posts
PHP in MODX is called up in snippets. So, you'd place your custom PHP code in a Snippet, name it [[mySnippet]], and call up that snippet in the HTML instead of the PHP.
http://rtfm.modx.com/revolution/2.x/developing-in-modx/basic-development/snippets
Short answer, yes, MODX can do this. MODX can do just about anything you want it to do.
MODX has its own database. It *is* possible to access a separate data source from inside MODX, but you might also want to move the data tables into the MODX database and use the built-in xPDO methods to access it.
-
☆ A M B ☆
- 24,524 Posts
Since MODX connects to its database using PDO (xPDO is a set of extensions to the basic PHP PDO library), you would have to make a separate connection to the database to use the mysqli functions.
If your site is already using PDO in your database access code, you can use the same code in MODX snippets. The xPDO extension do add a lot of nice data access features, though.
Thanks for your help guys. Much appreciated.