Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-01-18 00:05:43

~cXc~
Plugin Author
Registered: 2010-12-27
Posts: 39

[plugin] [ORPHAN] cxc_templates : front-end template management

PLEASE NOTE:
The plugin has been 4.5-ified by yauh/Stephan Hochhaus and is now available from his github account.

.

Original posting:
—————————————————————————
The cxc_templates plugin is a template management solution for TextPattern.

Plugin code is based on a modified version of mem_templates by Michael Manfre that was released with one of Stuart Butcher’s TXP 4.3.0 templates, which is based off of hcg_templates by Bert Garcia, which is based off of mcw_templates by Mike West with additional features introduced to an alternate hcg_templates provided by Mariano Absatz.

Without code contributions, help and tutoring from Martijn van der Ven and Stef Dawson, as well as, the mentioned plugins and contributions from all previously mentioned plugins this plugin would not have been made possible.

What it does is pretty much combine all of the features available from the various ???_templates plugins that have been shared with the community and adds some additional features that should help make the transition from other CMS platforms easier for new TXP users.


Google Code Project

Feature List

Template Import – this is the backbone of the plugin, this feature is used to add or overwrite all the required template files.

Safe Mode – allows you to import a template with out overwriting any existing database entries. When this setting is enabled the plugin will skip importing the forms, pages, sections and styles if the database already contains an entry with the same name and only import new entries. This setting will usually require additional editing and is turned off by default.

Template Export – exports all current forms, pages, plugins, sections, and styles utilized by your site to a directory of your choosing.

Delete Templates – allows you to delete an individual template directory or the entire “tpl” (or other default) directory.

Zip Projects – this feature will zip and download the template directory you select for sharing, please not, in order to share the template you will need to extract it, remove all unneeded files and zip it again. This feature is not perfect and I’m still working out why zips have to be extracted locally and zipped again before sharing but it is still very useful to designers even in its current state.

Template Upload – allows you to upload templates. By default this feature will also attempt to import the uploaded template if possible but this option can be unchecked before uploading. This feature also has an Advanced Option for webroot installations allowing designers to add files that need to remain outside the template directory, in most case this is discouraged though.

Language Strings – the plugin does not currently use textpacks but does utilize language strings, listed after the plugin code in the cxc_templates_gTxt() function. Using a textpack instead of the cxc_templates_gTxt() function is on the “to do” list.

Project Downloads

Current version is v0.1.0 (as of February 14, 2011)
http://code.google.com/p/cxc-templates/downloads/list

SVN Code Repository

You can check out a read-only working copy anonymously over HTTP.
svn checkout http://cxc-templates.googlecode.com/svn/

Additional Notes

To help with testing there are currently 2 templates to play with the TXP Default template which is just a copy of the template that comes with TextPattern to better illustrates 1-click installs and some minor changes that utilize most of the extra files that can be added to templates. The other is Stuart Butchers Translucence template which he was kind enough to convert to use the plugin during development.

REMEMBER, this plugin mucks around in the database so be careful, consider this a public beta release with RC hopes.

The Google Code wiki is not applicable anymore, if anyone is interested in contributing to the projects wiki please notify me and I’ll get you added to the list. This project has taught me that not only do I not like writing documentation but I totally suck at writing it also o.O I think I finally crossed over from writer to designer to developer :(

{Edited to complement the title and add the introductory reference. – Uli}

Last edited by uli (2013-01-15 16:32:42)

Offline

#2 2011-01-26 17:54:25

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: [plugin] [ORPHAN] cxc_templates : front-end template management

Been testing this, working fine so far.

The only question I have is why not use the /textpattern/tmp directory to unpack the zip files, instead of creating a top level cache directory?

Offline

#3 2011-01-26 18:26:39

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: [plugin] [ORPHAN] cxc_templates : front-end template management

I seems I can’t see any upload dropdown or other options, only two titles: ‘Import templates’ and ‘Export templates’, with a spare text and no options at all. Am I making some mistake in installation? I had previously installed a mem_template version: could that interfer? TXP 4.3 and cxc_templates 0.0.6.

Offline

#4 2011-01-26 18:37:58

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

Re: [plugin] [ORPHAN] cxc_templates : front-end template management

Zanza wrote:

I seems I can’t see any upload dropdown

Are you using v0.6?

W/ v0.5 I had an issue with uploads failing because my host didn’t have the ziparchive class enabled (which is what the plugin uses). cxc told me that his intention was to not have the option to upload appear if the class was not available and would update the plugin accordingly. I’m guessing that it may have got into v0.6

Offline

#5 2011-01-26 19:18:05

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: [plugin] [ORPHAN] cxc_templates : front-end template management

Maybe that could be the issue. Anyway, how can one know? What should I check? Yes, I’m using 0.0.6.

The dropdown and other controls don’t appear even if I manually upload the zips…

Offline

#6 2011-01-26 19:30:46

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

Re: [plugin] [ORPHAN] cxc_templates : front-end template management

Zanza wrote:

Anyway, how can one know? What should I check?

Probably the most efficient way is to check with your host.

In my case I googled class ‘ZipArchive and my host’s name. From the hits I found out that php 5.2.x (the standard install on my host) didn’t have it enabled by default. You had to enable it in the php.ini. However, php 5.3x was available as beta, and did have it enabled by default.

The dropdown and other controls don’t appear even if I manually upload the zips…

That would make sense — without the zip class it can’t unzip the file, so I think the reasoning is there’s not point in showing something you can’t do anything with. In the meantime you could ftp an unzipped version of the template. I think that will allow you to import.

Last edited by maverick (2011-01-26 19:31:09)

Offline

#7 2011-01-27 01:48:15

~cXc~
Plugin Author
Registered: 2010-12-27
Posts: 39

Re: [plugin] [ORPHAN] cxc_templates : front-end template management

@hcgtv I have been working on removing the cache folder, it was originally planned to compliment many of the templates Stuart had released since he seemed to be the most active template designer. With some of his templates he uses a thumb script that uses the cache folder but he also thought I should remove the use of cache from the plugin. I planned to have this ready before I release the 0.1.0 version, early attempts to change it failed but that was mostly because I wasn’t thinking it through properly o.O

When I first began working on the plugin it didn’t have “Upload Template: Advanced Options </> – Web Root Installation” so template providers were still forced to use FTP for any necessary webroot files and folders that might be included with templates, so Stuart can create a common support archive that contains the thumb script and the cache folder with an index.html file in it and use the webroot installation for the common archive and then use the standard template upload for template files … or technically he could just make one archive that uses the webroot installation but if the person installing the template doesn’t use the default ‘tpl’ directory the archive will install to the wrong directory. Since this feature can be abused its not recommended and should only be used if the designer is trustworthy and has instructed you to do so.

In other words continuing to use the cache folder for the reason it was originally used is no longer necessary :) it does include an optional extra step to do it the way I mention above unless the user has already used the common archive but its still a simpler method than forcing users to ftp templates and required files ;)

@Zanza what maverick is telling is probably what is going on and he is right in my thinking process. I thought doing it this way would make sense and be the best way to handle it. Now, I think it was not the best way to handle it and I will change it to show the header with a toggle to explain that the ZipArchive class is unavailable and show instructions for the php.ini edit that can be used to activate the class if available.

@maverick thanks for explaining what was going on to Zanza, I appreciate it :)

@everyone I’ll try to get the cache folder changed to use textpattern/tmp and change how the plugin handles not having the ZipArchive class available. If all goes well I’ll have this finished by the weekend and get v0.0.7 added to the available downloads.

Last edited by ~cXc~ (2011-01-27 05:30:15)

Offline

#8 2011-01-27 04:43:36

~cXc~
Plugin Author
Registered: 2010-12-27
Posts: 39

Re: [plugin] [ORPHAN] cxc_templates : front-end template management

I’ve removed the cache folder dependency and began adding an alternative for the ZipArchive class not being available. Right now the alternative is not fully implemented but functions to display alternate content, I just need to decide how to go about explaining the issue and ways to go about solving the problem. Since its not fully implemented I’m not ready to increment the release to v0.0.7 but have made a v0.0.6b available in the SVN for anyone interested in getting a sneak peek at it please get it from there or use these links.

Standard: http://cxc-templates.googlecode.com/svn/wiki/assets/cxc_templates_v0.0.6b.txt
Zipped: http://cxc-templates.googlecode.com/svn/wiki/assets/cxc_templates_v0.0.6b_zip.txt

These will not be added to the public downloads since I haven’t finished implementing it yet, hopefully it will be ready in a couple days. I plan to release v0.1.0 by the end of the month so please report any issues you are finding or additional features you want me to consider so I can start working on them as soon as possible.

Last edited by ~cXc~ (2011-01-27 05:32:02)

Offline

#9 2011-01-27 08:56:13

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,468
Website GitHub

Re: [plugin] [ORPHAN] cxc_templates : front-end template management

cXc wrote:

an alternative for the ZipArchive class not being available

fwiw I ran into the same issue with smd_admin_themes. Because I couldn’t rely on the various classes/extensions being loaded in the PHP environment I ended up including — at great pluign size expense — custom libraries that I downloaded from PHPClasses so I could offer Zip support across the board. Check the plugin source if you feel like not having to reinvent the wheel!


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#10 2011-01-27 10:14:38

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: [plugin] [ORPHAN] cxc_templates : front-end template management

cXc: I tried the 6b version and can confirm that ZipArchive class is not available (upload template message does appear). Don’t know the best way out (if support other classes, modify php.ini or include custom class as Bloke suggested). I’m available for testing, though. The hosting where I’m trying this is cheap and very common in my country. Haven’t tried in better quality hosting yet.

Offline

#11 2011-01-27 10:18:57

~cXc~
Plugin Author
Registered: 2010-12-27
Posts: 39

Re: [plugin] [ORPHAN] cxc_templates : front-end template management

Stef, I must have edited it from the post above but its actually stated in the tracker that for the solution you use “I barely understand it :( that’s why I was only able to offer support for .zip formats.”

I just don’t understand how it works or how to use it

I was going to keep trying to figure out how it worked and if possible try to get it into a v0.2.0 version but I’m not sure if I will be able to figure it out :( I’m actually pretty new to working with classes and to be honest I just recently started to understand functions, I’m learning as I go

@Zanza I will try looking through Stef’s plugin again, I just need to figure out how to get it to extract and recursively zip a directory … o.O sounds simple doesn’t it

In my opinion solving this problem will complete what I had planned to do when I began working on the plugin …

Last edited by ~cXc~ (2011-01-27 10:26:27)

Offline

#12 2011-01-27 10:42:40

Zanza
Plugin Author
Registered: 2005-08-18
Posts: 699
Website

Re: [plugin] [ORPHAN] cxc_templates : front-end template management

@ cXc: Don’t worry and take your time, your efforts are greatly apreciated. :)

Offline

Board footer

Powered by FluxBB