Using scripts to create assets

Can I use a script to create a set of assets?


I have a number of almost identical websites to create over the next few months. Each website will be for a local branch of my organisation.



I've been working with Squiz to develop a set of admin tools that will work for each of these sites - but for this to work, the creation of each site requires specific links to be created, specifically named assets etc.



Is it possible to script all this? So that if I enter the starting asset id (eg for the site asset) all the other standard assets will be created below that point?

[quote]Can I use a script to create a set of assets?


I have a number of almost identical websites to create over the next few months. Each website will be for a local branch of my organisation.



I've been working with Squiz to develop a set of admin tools that will work for each of these sites - but for this to work, the creation of each site requires specific links to be created, specifically named assets etc.



Is it possible to script all this? So that if I enter the starting asset id (eg for the site asset) all the other standard assets will be created below that point?[/quote]

To an extent, Matrix assets can be exported and imported by using the export_to_xml.php and import_from_xml.php scripts respectively.

I say "to an extent" as the import script performs no validation of data from the supplied XML file. Supporting files such as images would have to be stored in a directory for use with the XML import file.



Depending on the size of each site, it might be worthwhile creating a "generic site" which contains components that will be common across all of the prospective sites. Then smaller XML imports containing new assets or link alterations would be applied to a clone of this site when created.



I would recommend contacting Squiz to assess your requirements and assist with the running of any import, as an improperly-configured import can potentially corrupt your system.


I've been working with Squiz to develop the system that I now need to replicate many times.. sadly, my budget has run out, and this was also outside the scope of what I asked Squiz to do. So in the spirit of DIY, and all that - I thought I would ask the question.

I'm still interested in pursuing this option - so if anyone has any experience doing this sort of thing, it would be great to see how you did it, and maybe some examples of how you did it.