Hi There,
We’ve created a core wireframe site that contains layout and functionality common to many sites we implement. We’re hoping there’s a way to either import the Template Variables, Chunks and Templates into new Modx installations or create a custom installer that would setup our standard site during instalation - is this possible?
Any pointers in the right direction would be appreciated. BTW we have no PHP experience - sorry!
Cheers
-
☆ A M B ☆
- 721 Posts
The easiest way is to export your database from the core wireframe and when you install MODx, log into the new database and import the file you exported. You’ll have everything. However, take note of file paths, the site name, etc. and restore them back to the paths relevant to the new install.
The other option is to save your templates as files and simply manually create them with cut and paste but you can install your chunks, snippets, modules, and plugins by copy and pasting them into .tpl files and putting them under the appropriate folder in your modx install files (look at the .tpl files in the install folder (if memory serves) to see how to format the php header that goes above the code of your chunks, snippets, modules, and plugins.
Unfortunately at this time you can’t do the same with templates and template variables. If I could figure out which specific database tables handle those perhaps exporting and importing the specific tables in mySQL would work.
Personally I would install the default then add any snippets etc that you want, then export the database and files. When you want to install it again simply upload the files, create the new database and change the database details in "manager >> Includes >> config.inc.php".
All you have to do then is go to yoursite.com/install and run the upgrade option.
Thanks for the replies.
@rx2
Are you talking about using MyPHP Admin or is this done through Modx somewhere? I tried this via MyPHP Admin but it added the new tables to the existing ones so maybe I would have to delete the existing tables before importing my wireframe ones?
The only issue I can see straight away is that if I were to import the wireframe database, it would have the same names as other wireframe databases which would be an issue on our shared hosting I guess? Maybe I could find and replace the name and table prefixes in the exported sql file before importing?
@paulp
When you say "export the database and files" is that from Modx or do you mean copying the whole Modx folder?
Sorry, I didn’t quite understand the suggestions!
Cheers
OK, I think I understand a bit more now.
I tried the following:
- Exported the wireframe database from MyPHP Admin
- Did a find and replace in the resulting .sql file and changed the database name and table prefix to the new site details
- Created a new database and imported the tables from the modified .sql file above
- Duplicated the entire wireframe Modx folder on the server with a new name
- Changed the database details inside the new site’s Modx folder to the new database in the config file at: >manager >includes >config.inc.php
However, when type in the http://sitename/manager/ URL to log in we get a "The requested URL /manager was not found on this server." error.
Do the steps above look right, we’re using MAMP Pro on a laptop BTW...
Any suggestions would be welcome..
Cheers
OK, for some reason MAMP wasn’t inserting the full path to the location of the new site - everything seems to work now.
Thanks for the suggestions!
Cheers
Ben