vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=32754

Export and import templates to individual files!
by Chen
27 Nov 2001 16:10

1 Attachment(s)
I'm releasing this as beta because:
  • This has not been tested enough to prove it's working 100%.
  • Your templates aren't something that can be compromised.

In short, what does this hack do:
  • Can write all your templates into files, with any extension you'd like (.html is my favorite), having each template in its own file.
  • Can read from existing template files and save them back to your forum system.
  • Now with option to selectively choose what templates to import / export!

To install:
  • Download the attached ZIP file, extract it and upload do_template.php to your forum admin folder.
  • Go to the file in your browser.
  • If you are not on a Windows server, make sure PHP has permission to write (CHMOD 0777) in the folder you specify.
  • If the folder doesn't exist, PHP will attempt to create it, but you will need write permissions (CHMOD 0777) in the parent folder of it.

Please test this if you can.
If you're trying this out on your real board, it should be safe, but I highly recommend backing up your styles before using it.

This is the place to make suggestions, I expect some! :)

snyx 27 Nov 2001 19:40

whoa, me likes this concept man!
I will install it on a dummy system asap, and get back to ya!

Parker Clack 27 Nov 2001 19:47

Chen:

I just installed it on my server and it works like a champ at downloading them. I haven't try to upload any of them though. It would be cool if you could pick out which ones you would like to import instead of importing them all.

Parker

SteveK 27 Nov 2001 22:39

I've just tried downloading once in text mode and it works great. Will try other file types and importing later.

How about the ability through the interface to delete previously saved directories of templates. Since the directory and files are written by www, you can't easily remove them via ftp.

Another idea would be the ability to save the templates in a user specified directory besides the forum/admin directory. Best would be below root but don't know if this is possible.

And one more idea would be a drop down box that would allow you to select just a few templates to download vs. a complete dump of all templates.

Okay, just one more idea.... how about being able to zip them up and send the downloaded templates out to us via email?? This is handy as many times I'm not on a system that I can FTP from (due to company proxy settings)

This is a great tool and will make template life much easier!

Steve

Parker Clack 28 Nov 2001 05:38

When you import a template do you have to delete the other template first before importing or does it just write over the top of the old one?

I agree that a file that is created that you could download as one big file would be great. What if you wrote it so that all of the information is written to one file, like the style file is, and then you could just import that one file back in.

This is a great idea and I know it will be utilized a lot around the sites with vB.

Thanks again,
Parker

Chen 28 Nov 2001 10:37

Quote:

Originally posted by Parker Clack
Chen:

I just installed it on my server and it works like a champ at downloading them. I haven't try to upload any of them though. It would be cool if you could pick out which ones you would like to import instead of importing them all.

Parker

To only import some templates, you can delete all the others you don't want.
Also (not sure if I mentioned this already :)), the script only updates templates that have changed.
If you try and only edit one file, and then updating the templates, you'll see only that template is listed as updated, and all the others were skipped.

Chen 28 Nov 2001 10:44

Quote:

Originally posted by SteveK
I've just tried downloading once in text mode and it works great. Will try other file types and importing later.
To clarify, selecting .zip as the extension won't actually make the files zipped! They will still be in text mode.

How about the ability through the interface to delete previously saved directories of templates. Since the directory and files are written by www, you can't easily remove them via ftp.
That would require either saving all templates folders to the database in a special table, or having a script to go through the server and letting you do stuff with folders.

Another idea would be the ability to save the templates in a user specified directory besides the forum/admin directory. Best would be below root but don't know if this is possible.
AFAIK, you can't CHMOD folders below your public folder. Because of that, PHP won't be able to write to these folders.
TBH I don't really see the need for specifying folders that deep. :stupid:


And one more idea would be a drop down box that would allow you to select just a few templates to download vs. a complete dump of all templates.
Ok, I think I will add some kind of select box you can select templates from. Altough it would be very hard for the user to select all templates he wants, if there are a lot of them.

Okay, just one more idea.... how about being able to zip them up and send the downloaded templates out to us via email?? This is handy as many times I'm not on a system that I can FTP from (due to company proxy settings)
I actually thought of that, and I was sure it's a great idea.
The problem is, not all servers can zip files/folders on the server, because a special module is needed. And most servers don't have this. :(


This is a great tool and will make template life much easier!

Steve [/B]

Chen 28 Nov 2001 10:47

Quote:

Originally posted by Parker Clack
When you import a template do you have to delete the other template first before importing or does it just write over the top of the old one?

I agree that a file that is created that you could download as one big file would be great. What if you wrote it so that all of the information is written to one file, like the style file is, and then you could just import that one file back in.

This is a great idea and I know it will be utilized a lot around the sites with vB.

Thanks again,
Parker

If you import a template that already exists, the original template is overwritten (if it's a modified template), and if it's a default template a new template is added to the template set. (don't worry, it's exactly how it works with the admin cp :))

Doing what you just said, exporting to one file and importing from it, is exactly how it's being done today.
This is a bad way to upgrade, IMO (and others'), and it's why I created this script.
So doing what you suggested will actually be a step back. :)

Chen 28 Nov 2001 10:49

To demonstrate what the main intention of this hack is:
Let's say you upgrade from v2 to v3.
So you download your current (modified) v2 templates, and to another folder you download the original v3 templates.
Then you can use something like Beyond Compare or Araxis Merge to compare the two folders, on a file to file basis.
Then when you're done, you just upload the templates back to a folder, and import them back using this script.

Chen 28 Nov 2001 13:17

1 Attachment(s)
Ok, so I worked this afternoon about this, and now you have an option to selectively choose which templates to import. (see screen shot)

I'm not working on the same thing for the export process. (which is a bit more complicated than I thought!)

Heh, it took me 20 minutes (and a Google search ;)) to realize I need to put [] next to the input name when doing:
<select name="blbla[]" multiple>
:p

*t00t* *t00t*
by Chen
28 Nov 2001 13:27

Finally. :)

Now you can select which templates to export or import then you run the script (there is a little drop down menu for selecting Yes or No).

Just upload the new file to 'upgrade'. ;)

Parker Clack 29 Nov 2001 11:43

Chen:

Thanks for the upgrade and the explanation.

Great hack!!

Parker

FWC 01 Dec 2001 23:11

This is very cool, Chen! :)

Hooper 02 Dec 2001 03:46

Good Grief Chen,

I don't know which is better. The new hack for including WOL links. Or this. Or the Advertisement hack.

They are all great. I have been backing up my templates into text files by hand since I purchased vBulletin. This is unreal. What took me a half hour now litteraly takes me less than 5 seconds. And the select what templates to import and export....all I can say is WOW. I went ahead and added it to the Admin CP.

---------------------------------------------------------------------------------

Question: When downloading a template set other than the default it always says that it downloaded the default. What might cause this? It seems to be backing up the correct template set, but for some reason it says default no matter what the name of the template set is. Sorry if someone already asked.

Question: I am not seeing a section that says downloading Users Custom Templates. What might be the cause of this? Sorry if someone already asked.

---------------------------------------------------------------------------------

Thanks Chen.

Crinos 02 Dec 2001 11:10

Installed and working great for downloading the template files :)

Haven't tried the import feature yet though


All times are GMT. The time now is 13:15.

Powered by vBulletin® Version 3.8.14
Copyright © 2020, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.