Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: I made some scripts that import/export templates, forms and css
i hanv’et done any work on this in a while and i’m not at my computer to check but i know that i had coded an option to create new forms templates etc. I just don’t remember if it was in a version i was using or the veriosn i had available for download. Either way it will be availabe within a day or two.
I agree that this is a great way to export templates and import template packages. I know that i recelnt used a teplate i downloaded and it took a long time to update css, forms and pages, so a standard would be nice so a user could just export the old (for backup purposes) and import the new.
I don’t know if I’ll be able to make this an admin plugin but I plan on making it one file with a drop down option to import or export and perhaps include a form for choosing a sub folder so it is easier to organize theme import/exports.
Other suggestions are more than welcome.
Last edited by swf (2005-06-19 05:47:58)
Offline
Re: I made some scripts that import/export templates, forms and css
If it will add back forms, pages and css back to the db that aren’t already there, I don’t know what else it would need.
Hmmmm….I don’t know if plugins/image tables can be handled the same, now that would be a nice addition, but only if there was a toggle to choose. That would really take care of a templating engine as well that everyone has been wishing for. I have been using txp image handling for template/design elements. It makes it nice when linking in the page and css for the graphical elements, but becomes problematic for site migration or a site install that has gone awry. If this was an admin plugin with select boxes to pick what elements would be exported/imported from the db, now that would be ideal.
This would be a far superior way for problematic upgrades/downgrades in txp (more what I have used it for). Maybe someone will volunteer to help you wrap this into an admin side plugin with selects for elements to export. That is out of my range of capability. But I’m sure someone would jump in and lend a hand.
Offline
#27 2005-06-19 14:28:09
- davidm
- Member
- From: Paris, France
- Registered: 2004-04-27
- Posts: 719
Re: I made some scripts that import/export templates, forms and css
Now that’s interresting ideas, also out of my range I am afraid… if things go on like this, the community will build the templating engine before zem, kusor and dean even start toying with it :-p
.: Retired :.
Offline
#28 2005-06-21 14:14:20
- uHunkler
- New Member
- From: Braunschweig
- Registered: 2005-01-11
- Posts: 4
Re: I made some scripts that import/export templates, forms and css
Hi Scott and everybody,
I started to use your great scripts. It’s very handy to be able to work with TopStyle Pro ;-) on the files. But I can not get “page_default.php” to import back into TXP RC3. All other files work. Do you or anybody know the reason and the solution?
Thank you very much for your help.
Urs
Last edited by uHunkler (2005-06-21 14:17:18)
Offline
Re: I made some scripts that import/export templates, forms and css
Sounds weird but have you tried this? Delete the copy on your webserver (don’t just overwrite it) then upload our local version and then try import again. I know my server has some problem with permissions and this solves it. Otherwise I’m not sure why it wouldn’t import that one .
Offline
#30 2005-06-21 19:54:24
- uHunkler
- New Member
- From: Braunschweig
- Registered: 2005-01-11
- Posts: 4
Re: I made some scripts that import/export templates, forms and css
Scott, thank you very much for your fast response. I’ve tried your proposal but without success. In the moment I work localy on a Xampp installation. When I am ready with the TXP design I will port TXP to a linux webserver and will see what happens there. I’ll tell you how it goes.
Urs
Last edited by uHunkler (2005-06-22 19:05:36)
Offline
#31 2005-06-22 09:30:51
- uHunkler
- New Member
- From: Braunschweig
- Registered: 2005-01-11
- Posts: 4
Re: I made some scripts that import/export templates, forms and css
Scott, the situation kept me thinking. I found the reason:
The apostrophe '
in the JS call: onclick="onOff('de'); return false;"
hindered your script to place the code in the datafield. When I escape the apostrophe like onclick="onOff(\'de\'); return false;"
everything goes well. The line in the code in TXP after the import looks like the first one, the backslash has been deleted during the import.
Can you reproduce the situation? Does it have to do with the MySQL import function? Can you integrate a workaround in your scripts escaping the single quote after having read the files?
I tried a patch of your script, which works for me. One added line replaces the apostrophe with the escaped one:
# update db page table where row name is $template_name
$template_data2 = str_replace("\x27", "\x5c\x27", $template_data);
safe_update("txp_page", "user_html = '$template_data2'", "name = '$template_name
[1]'");
I am no PHP programmer, so please look if this patch is ok.
I hope I am on the right way ;-)
Urs
Last edited by uHunkler (2005-06-22 09:37:59)
Offline
Re: I made some scripts that import/export templates, forms and css
how did i miss this before???
thank you so much scott, i love being able to edit and back up to my hearts content!
~~~~~~~~~~~~~| monolinea.com | pixilate.com | istockphoto.com/kemie |~~~~~~~~~~~~~
Offline
Re: I made some scripts that import/export templates, forms and css
@kemie
Same here kemie. I bookmarked the thread when he made the scripts a year ago and never really needed them until a month ago. I think I spent a hour sifting through my bookmarks to find the damned link. It looks like its geeting good mileage now that its been brought back from the forum boneyard.
The scripts work great and there’s some really great potential here for using this for server migration. export forms/css/pages/image info—>new server—>fresh txp install—>import forms/css/pages/image info NO sql version conflicts! No php version conflicts! It will take a really bad variable out and make it irrelevent. I hope someone jumps in to help him work this into something admin and realize its full potential.
Offline
Re: I made some scripts that import/export templates, forms and css
Link is down, anyone care to mirror?
Offline
Offline
Re: I made some scripts that import/export templates, forms and css
I’m lost when it come to escapeing characters, but at least you figured it out. I don’t really know what your string replace is doing. Is it a fix only for your template or for and single quote?
BTW:
I’m trying to move all my stuff over to a new domain so you can also download here
Offline