ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

My first module - Manage templates as external files

February 05, 2008 1:29pm

Subscribe [14]
  • #1 / Feb 05, 2008 1:29pm

    louis w

    450 posts

    I have a working prototype of my Template Files module.

    It will export your database templates to external files (but will not overwite files which are newer then your database copy).
    It will import templates from external files into your database (but will not overwrite db if the db is newer then your file).

    Seems pretty safe, but this is a pre-release so I would not run it against data you are afraid to loose.

    Development is not complete, there are a number of items missing from what I would consider a final product. You will also notice some of the language values are not mapped yet (like the update result desc).


    Any feedback would be great.

    ———————————————————————-

    FILE UPDATED
    New release is available here

    ———————————————————————-

    Here are some screen shots of it in action:


    Home Screen:
    http://skitch.com/louiswalch/f477/template-files-expressionengine

    Result Screen - Exporting Templates:
    http://skitch.com/louiswalch/f475/template-files-expressionengine-1

    Result Screen - Importing Templates:
    http://skitch.com/louiswalch/f475/template-files-expressionengine-2

  • #2 / Feb 05, 2008 1:43pm

    Mark Bowen

    12637 posts

    Hi Louis,

    Sounds really neat! Well done on your first module. Maybe one of the admins will place this into the modules forum for you though as you will probably get better coverage in that way.

    Best wishes,

    Mark

  • #3 / Feb 05, 2008 1:44pm

    silenz

    1651 posts

    What are the advantages compared to Saving Templates as Text Files?

  • #4 / Feb 05, 2008 1:45pm

    louis w

    450 posts

    Thanks Mark 😊

    No license over here yet, I just downloaded the software last week and still playing around with it.

  • #5 / Feb 05, 2008 1:46pm

    tbritton

    714 posts

    Super! I’ll give it a run through and let you know if anything breaks! (All is backed up first, of course!)

    This will definitely benefit everyone working with templates as files. Thanks!

    Terry

  • #6 / Feb 05, 2008 1:49pm

    tbritton

    714 posts

    What are the advantages compared to Saving Templates as Text Files?

    This is “Saving Templates as Text Files” on steroids!

    BTW - You have to have Save Templates as Text Files set with a path to a template_files folder in global template preferences for this module to work.

    This module saves the work of checking every box at the bottom of a template manually, plus it re-imports your flat-files back into the database so you can take advantage of revisions control, search and replace from the utilities CP, and other things.

    Terry

  • #7 / Feb 05, 2008 1:52pm

    louis w

    450 posts

    @silenz:
    Good question. I guess I should have outlined it a bit more. This module automates the saving as text process. Instead of having to go into each template and export/update for each one, this module will batch import/export all the templates you at once.

    When managing a site with numerous templates, having to save or update each template at a time would be a tedious process. 

    This is designed for people who prefer to edit their template code with a text editor like BBEdit or Dramweaver and easily apply the changes to their site.

  • #8 / Feb 05, 2008 2:09pm

    silenz

    1651 posts

    Not to be confused: I was not referring to exporting templates (you can export whole template groups as zip-file btw) but to running flat file templates.

  • #9 / Feb 05, 2008 2:40pm

    louis w

    450 posts

    @silenz:
    This module will work in conjunction with the flat file templates by allowing you to ‘Save as Text File’ in mass and also allow you to batch import the file contents into the db. Database does not automatically update with the file contents, the article above says:

    Note:  If you have been making changes to your template files via FTP, and you then go back to the Template editing page, ExpressionEngine will load the file version into the form.  However, unless you click “save”, the database will still contain the last version you saved via the Control Panel.

    If you do not update the template in the database, it will not be immediately reflected on the website.

    I am just trying to automate the flat file process a little bit more.

  • #10 / Feb 05, 2008 3:23pm

    silenz

    1651 posts

    @silenz:

    If you do not update the template in the database, it will not be immediately reflected on the website.

    When running flatfiles, pages are not rendered from the database version of the template but from the files, so it is immediately refelcted, just to clarify.

  • #11 / Feb 05, 2008 3:26pm

    louis w

    450 posts

    @silenz:

    If you do not update the template in the database, it will not be immediately reflected on the website.

    When running flatfiles, pages are not rendered from the database version of the template but from the files, so it is immediately refelcted, just to clarify.

    I am not 100% familiar with EE, so I may be mistaken.  What about when you are running cached pages? I tested this earlier by updating a template which was being embedded into another template on the server and not updating the db. When i visited my site, I did not see the update. After I updated the db, the site did reflect the change I made.

    Is this not correct?

  • #12 / Feb 05, 2008 3:27pm

    tbritton

    714 posts

    @silenz:

    If you do not update the template in the database, it will not be immediately reflected on the website.

    When running flatfiles, pages are not rendered from the database version of the template but from the files, so it is immediately refelcted, just to clarify.

    Right. Like I said, it re-imports your flat-files back into the database so you can take advantage of revisions control, search and replace from the utilities CP, and other things.

    I am not 100% familiar with EE, so I may be mistaken.  What about when you are running cached pages? I tested this earlier by updating a template which was being embedded into another template on the server and not updating the db. When i visited my site, I did not see the update. After I updated the db, the site did reflect the change I made.

    Is this not correct?

    That’s interesting - I didn’t know you’d have to clear your caches for a flat file to update (in that case). I’ve never heard that anywhere before. (I generally don’t cache templates, so I never ran into that.)

    Terry

  • #13 / Feb 05, 2008 3:34pm

    louis w

    450 posts

    When you say flat file, you just mean checking the ‘Save Template as Text’ box in the template, right?

  • #14 / Feb 05, 2008 3:45pm

    tbritton

    714 posts

    When you say flat file, you just mean checking the ‘Save Template as Text’ box in the template, right?

    Yes, that’s what I mean.

    Terry

  • #15 / Feb 05, 2008 6:59pm

    louis w

    450 posts

    I have made some improvements to this module. Here is a new version.

    Updates:
    * Improvements to language files
    * Additions of graphics
    * Fixed the de-install
    * Added a box to check/uncheck all

    Because the de-install was broken, if you have already installed this you will need to update the files on your server with the attachment if you wish to remove the module.

    As always, feel free to share any features you would like to see included.

    ———————————————————————-

    FILE UPDATED
    New release is available here

    ———————————————————————-

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases