Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Theme mechanism for TxP 4.0.X
After spending a few days, I think I have a working mechanism.
Using mcw_templates, I created a new plugin that uses a root level directory called /templates, this keeps user data away from the /textpattern directory, similar to /files and /images.
Sample Kubrick template layout:
- /templates
- ../kubrick
- ../files
- nicetitle.js
- ../forms
- kubrick_default.article.html
- kubrick_search_results.article.html
- kubrick_comments.comment.html
- kubrick_comment_form.comment.html
- kubrick_popupcomments.comment.html
- kubrick_files.file.html
- kubrick_plainlinks.link.html
- ../images
- kubrickheader.jpg
- kubrickfooter.jpg
- ../pages
- kubrick_default.html
- ../plugins
- hcg_templates-0.3.txt
- ../style
- kubrick_default.css
- ../files
- ../kubrick
The /templates directory should contain an .htaccess file to keep prying eyes out of your templates but still allow access to the files and images subdirectories.
This mechanism is working for me locally, just looking for comments in case I missed something.
Last edited by hcgtv (2007-03-17 00:17:05)
We Love TXP . TXP Themes . TXP Tags . TXP Planet . TXP Make
Offline
Re: Theme mechanism for TxP 4.0.X
This is really well thought out and needed work. Thank you.
Offline
Re: Theme mechanism for TxP 4.0.X
Sample Kubrick template layout, part deux:
- /templates
- ../kubrick
- kubrick_default.page.html
- kubrick_default.article.html
- kubrick_search_results.article.html
- kubrick_comments.comment.html
- kubrick_comment_form.comment.html
- kubrick_popupcomments.comment.html
- kubrick_files.file.html
- kubrick_plainlinks.link.html
- kubrick_default.style.css
- …
- ../files
- nicetitle.js
- ../images
- kubrickheader.jpg
- kubrickfooter.jpg
- ../plugins
- hcg_templates-0.3.txt
- ../kubrick
We Love TXP . TXP Themes . TXP Tags . TXP Planet . TXP Make
Offline
#4 2007-03-17 09:07:52
- mapu
- Member
- From: Munich, Germany
- Registered: 2004-03-16
- Posts: 141
Re: Theme mechanism for TxP 4.0.X
I like the first example better. Very good idea, indeed. Especially to implement needed plugins. That way, template packages could be made even more feature filled ;)
But why an extra .htaccess file? Putting an empty index.html into that folder could do the same job.
Offline
Re: Theme mechanism for TxP 4.0.X
mapu wrote:
I like the first example better. Very good idea, indeed. Especially to implement needed plugins. That way, template packages could be made even more feature filled ;)
In the second example everything resides in one top level folder, I just found it easier while working on templates with an editor, less clicking around. Plugins should be included, this way the user doesn’t have to go hunting them down or running the risk of the plugin version they need getting lost in cyberspace.
But why an extra .htaccess file? Putting an empty index.html into that folder could do the same job.
Template authors would need to remember to add an empty index.html to their folders and the plugin would have to be modified to output index.html when it does it’s export routine. Either or works fine, it depends on how you’d like to approach it.
We Love TXP . TXP Themes . TXP Tags . TXP Planet . TXP Make
Offline
Re: Theme mechanism for TxP 4.0.X
Questions,
Why not put it in /textpattern/ and avoid the whole index.html .htaccess mumbo jumbo?
Why preceed the files with kubrick_ if they are in a Kubrick folder? If we are going to use a prefix shouldn’t all files have them (ie. nicetitles.js)?
Really good work here.
Shoving is the answer – pusher robot
Offline
Re: Theme mechanism for TxP 4.0.X
hakjoon wrote:
Why not put it in /textpattern/ and avoid the whole index.html .htaccess mumbo jumbo?
The good:
- I think of Textpattern as the core, sort of like /bin, templates are user generated additions, either /usr or /opt material. This also makes it easier to do folder comparisons on system upgrades.
- background:url(../textpattern/_templates/mistylook/img/icon_feed.gif) no-repeat left center; background:url(/templates/mistylook/images/icon_feed.gif) no-repeat left center; less typing
- Hard coding ../textpattern is not future proof, the textpattern directory may be able to move around one day. unless we can have CSS conditionals
The bad:
- Needs protection.
- mcw_templates forks, where we could instead further one code base. But the code should be opened, like you’re doing with zem event code.
Why preceed the files with kubrick_ if they are in a Kubrick folder?
- In the admin section, you will have the opportunity to work on Kubrick while your site still runs fine on the old template. When you’re ready, set the section defaults and away you go.
- You may also install different templates to learn from, it’s a great way to get up to speed.
If we are going to use a prefix shouldn’t all files have them (ie. nicetitles.js)?
Cause they’re in the Kubrick folder :)
Really good work here.
Open Source is a scratch your own itch type of thing. I came from Nucleus CMS that has the ability to pick looks from a list, Textpattern on the other hand is more of a CMS, but I miss the templating capabilities.
Over the last three months, I’ve been creating templates locally for my live sites. Thanks to changes in the upcoming 4.0.5, I can pick what Page and Style is the default when I enter that tab. EditArea allows me to work more in the Admin section and less in an external editor. Textpattern, the template machine, who woulda thought ;)
Thanks to everyone for the feedback, cause it either solidifies my thoughts or makes me rethink them, and words of encouragement always give you a second wind.
We Love TXP . TXP Themes . TXP Tags . TXP Planet . TXP Make
Offline
Re: Theme mechanism for TxP 4.0.X
Like I said in the other thread Bert – more power to you! ;-)
Offline
Re: Theme mechanism for TxP 4.0.X
Thanks for the answers Bert. They make a lot of sense to me.
Shoving is the answer – pusher robot
Offline
Re: Theme mechanism for TxP 4.0.X
Ladies and gents, children of all ages…
The TxP Templates are performing in the center ring.
Last edited by hcgtv (2009-08-29 04:46:45)
We Love TXP . TXP Themes . TXP Tags . TXP Planet . TXP Make
Offline
#11 2007-03-18 10:10:31
- marios
- Archived Plugin Author
- Registered: 2005-03-12
- Posts: 1,253
Re: Theme mechanism for TxP 4.0.X
@bert, thanks for doing this. Your Initiatives highly appreciated :))
The thought, finally to moove the templates Folder out of the textpattern directory makes a lot of sense.
(Easier upgrading options, something that I didn’t consider along the lines at all )
The question now is, how to secure the folder, e.g.: Is mod_rewrite the only option, or are there any other ways to do this ?
regards, marios
Last edited by marios (2007-03-18 10:11:48)
⌃ ⇧ < ⎋ ⌃ ⇧ >
Offline
Re: Theme mechanism for TxP 4.0.X
How about moving it outside the webroot? Does hcg_templates require a web accessible path? That would make it the most secure.
Shoving is the answer – pusher robot
Offline