Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2006-10-23 16:04:40

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

Template Files and Naming conventions

Hello again,

I am writing this post, because I downloaded randomly some templates for testing purposes.
However, the main purpose was to see, how well goes mcw_templates with some randomly chosen templates
and 4.0.4.
My overall impression was a frustrating experience, to see at least a dozen of different manners to name these files.
So here is my general suggestion about naming those files.

Example:
Form Templates
Article Forms:
<code>my_example_form.article.txt</code>
File Forms:
<code>my_example_form.file.txt</code>
Comment Forms:
<code>some_other_dummy_example_form.comment.txt</code>

etc… (Same for link and miscs forms, which should have prepended link and misc before the actual file extension.)

Whitespace and brackets or other non-word characters should be avoided,
and everything preferably lowercase.

Eg.:comments_Form Template my_form.txt
or: some_comment_form (comment).txt or such other Exotic breeds is not a good Idea.

(Whitespace characters in file names create all sorts of problems, anyway)

I have been using a convention like this below for quite some time.

eg.: xxx_my_form_article.txfml

(Where xxx is a creator code and txfml a special file extension used mainly to distinguish between page files and form files)

mcw_templates however, will not be able to distinguish what is what (for the form template files), if it doesn’t find the form type descripter
prepended with a period before the file name, and thus you will be unable to perform an initial import session for a form template set.

For the new version of Textpattern Bundle, which will be released shortly, I through together some
commands, which will do the file name conversion automatically, but only if the form name descripter is seperated by an underscore.
(not hyphen or other characters)

To compensate for the other cases as well (white space and such), would make it necessary to call some complicated perl scripts,
which I don’t want to waste my time for.

The Same goes for the Folder Names as well:

They should be:
-pages
-forms
-css

(all lowercase again)

Although those do cause you less headache as the file names.

Any opinions, suggestions about this topic ?

Regards, marios


⌃ ⇧ < ⌃ ⇧ >

Offline

#2 2006-10-23 16:26:49

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

Re: Template Files and Naming conventions

Are you thinking in terms of using something like mcw_templates to install new themes?

Offline

#3 2006-10-23 16:36:42

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: Template Files and Naming conventions

I’m talking about the 4.0.4 world where we use this excellent plugin to install new template sets.
(I use it all the time for my own templates, and it’s working great if you keep your files in order)
But a general Naming convention guideline, that we could publish somewhere would make:

A) a lot of sense even without using the plugin
B) our lives a lot easier
C) Our workflows more productive

I am also working on a new Bundle Version for TextMate where this plugin becomes even more useful.
(No mysql stuff yet, Bastian Teerhorst has done a sql Bundle for TM, that can be used also)

regards, marios

(The forum doesn’t like html anymore)

Last edited by marios (2006-10-23 16:38:15)


⌃ ⇧ < ⌃ ⇧ >

Offline

#4 2006-10-24 00:02:07

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: Template Files and Naming conventions

Personally, I prefer single file templates. Like for my template, I just made one .txt file, named much like a plugin with the version # in it.

Something like this:

//------------------Pages
	//-------------page: stuff
	<txp:if_article_list>
		...
	</txp:if_article_list>

//------------------Forms
	//-------------form: single
	<txp:article_image />
	<txp:body />

//------------------Style/CSS
	//-------------style: default
	body {}

	//-------------style: ie
	html {
		display: none;
	}

Last edited by jm (2006-10-24 00:02:43)

Offline

#5 2006-10-24 00:56:42

Ace of Dubs
Member
Registered: 2006-04-17
Posts: 446

Re: Template Files and Naming conventions

interesting jm…but sounds like a heck of a lot of scrolling

yikes!

Offline

#6 2006-10-24 02:06:23

jm
Plugin Author
From: Missoula, MT
Registered: 2005-11-27
Posts: 1,746
Website

Re: Template Files and Naming conventions

Yeah, but I’d much rather scroll than have 20 files open. In my case, it was only ~200 lines. When I was starting with Textpattern, I tried a template, but ran screaming, after seeing tons of “p_default.txt, p_special.txt, f_this.txt, f_comments.txt”.

Offline

#7 2006-10-24 09:28:22

Ace of Dubs
Member
Registered: 2006-04-17
Posts: 446

Re: Template Files and Naming conventions

That’s why I use TextMate.. having 20 documents open really isnt that big a deal. If it works for you then kudos, but my CSS files alone would make the one-page template a nightmare!

Still I could see this being somewhat useful on a different scale. Having a doc for pages, another one for forms and a third for CSS might be the move

Thanks 4 sharin

Last edited by Ace of Dubs (2006-10-24 09:30:10)

Offline

#8 2006-10-25 01:46:45

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: Template Files and Naming conventions

To reiterate on this Idea, When you for example download a Template Set from the Textgarden Site, then
you will most likely find three Folders: Pages, Forms and css, which are used by mcw_templates to determine
the import path names used for the sql query that does it.
When you perform an export session, also you will have noticed , that the files, that spill out into the form Target Folder have the format : My_form.article.ext, my_form.comment.ext, my_form.file.ext, etc.

Template sets however, that name their files eg. my_form_comment.txt, or my_form (Article Form Template) front.txt, or article-my_form.txt, or such, are useless for an initial import session,
since there is no way how the backend could know which form is an article form and which is a file form etc.
In those cases then, it would be either necessary to modify the plugin code, (which is the last thing I would do to poke around in mikes excellent code) or to perform a find and replace on the file names.

So for my own needs, I wrote a command in TM, that does mainly three things:

1) it looks for the correct Folders and
2) renames all forms in the forms folder to the form mentioned above
3) adapts the file extensions.

(Note, that both folder names and file extensions can be adjusted in the plugin code ,prior to an export session)

The most important point though is, that the form type descriptor, which: is xxx.formtype.ext,
where formtype can have the 5 possible values of forms used
be present at a determined position in the filename, whether you work with TM or not.

The other conventions that I mentioned above, are also important, but don’t cause you that much trouble.
What will you do, if you want to make an initial import session, and you have 80 forms with exotic file names ?

regards, marios

Last edited by marios (2006-10-25 01:48:02)


⌃ ⇧ < ⌃ ⇧ >

Offline

#9 2006-11-10 02:38:58

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: Template Files and Naming conventions

Is there any interest still in this one, or shall we ditch it ?
(It was meant to save us all a lot of time and hassle)

(Moderators? Admins?)

regards, marios


⌃ ⇧ < ⌃ ⇧ >

Offline

#10 2006-11-10 14:01:13

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

Re: Template Files and Naming conventions

marios, I’m interested.

If we can have a standard naming convention where installing new templates would make it easier via a plugin and not trash existing ones already installed, I’m all for it.

Offline

#11 2006-11-10 16:28:59

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: Template Files and Naming conventions

I’ all for this too, but it seems that for any impact the standard would have to be enforced for Textgarden submissions. That way testing a theme becomes a matter of

  1. export current one as backup
  2. Import new one
  3. If you hate it import the old one back

Much easier then how it’s currently done.


Shoving is the answer – pusher robot

Offline

#12 2006-11-10 18:58:28

marios
Archived Plugin Author
Registered: 2005-03-12
Posts: 1,253

Re: Template Files and Naming conventions

What would you recommend, suggest , add, to set up a standard, that is both forwards and backwards compatible ?

There is also the concept of include headers, that can be inserted on each first line of those files as html comment.

Would it make sense to work to a commonly accepted standard ? Involve some more Core Developers, etc.

Zem had done a great job in the past for the plugin standards, and it proved itself useful. Even without a special mention , or a dedicated resource pointing to these conventions, the majority of the plugin developers did grasp this concept and it has worked until today.

A small comity, may be that’ll discuss these matters on a dedicated Blog / Site comes to my mind, ( Just as preliminary Idea)

regards, marios


⌃ ⇧ < ⌃ ⇧ >

Offline

Board footer

Powered by FluxBB