Joss Posted February 7, 2013 Posted February 7, 2013 I was thinking about creating myself a module to short cut certain site development. For instance, on a basic brochure site , it would be common to have a small news section that would vary very little from one site to another. So, all the module need to do is a one-off process on installation: Create: A bunch of fields using standard available field types, A handful of templates using the fields A few template files and some inc files in a separate folder (which may or may not exist yet) A few pages to weld it together. As I said, this is just a development short cut - you would still have to work it into the site, but it would reduce the work load. I suppose the result would be a skeleton module that could be used to create lots of variations of the above. The trouble is, I am not sure how to do the install functions for the above - especially the creation of actual files and/or folders. Any clues? Joss PS: Oh, I suppose an added function could be that you could get it to check if a particular field type existed (for instance, crop-image) and if not, download and install it!)
Soma Posted February 7, 2013 Posted February 7, 2013 Check this http://processwire.com/talk/topic/1051-adding-and-assigning-fields-without-using-gui/
Joss Posted February 7, 2013 Author Posted February 7, 2013 Thanks Soma! That at least gets me part of the way there. What about creating actual files (complete with content)?
Soma Posted February 7, 2013 Posted February 7, 2013 Creating files and all that http://php.net/manual/en/function.file-put-contents.php And this: https://github.com/ryancramerdesign/ProcessWire/blob/dev/wire/core/Functions.php
Soma Posted February 7, 2013 Posted February 7, 2013 Or simply use copy() to copy files from a dir to another. http://php.net/manual/de/function.copy.php doh!
Joss Posted February 7, 2013 Author Posted February 7, 2013 Ah, that is a good point. The files could just be in a subdirectory to the module and then just copied.... a bit obvious - why didnt I think about that???
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now