template folder: prefixing key files

8 views
Skip to first unread message

Kahi

unread,
Jan 31, 2008, 3:42:07 PM1/31/08
to habari-dev
I'd like suggest a change in theme folder files' naming convention...
Actually as far as I know there is no naming convention or rule of
this type yet, and this probably may be discussed... I spend some time
with developing themes for WP and what I missed is some kind of
marking that files, that are part of template hierarchy, from other
files, for example by a defined prefix. And while habari's theme
folder looks inspired by WP's (imho chaotic) theme folder, I ask you:
what's your opinion? I would appreciate such a change...

Image that illustrates files grouped by type:
http://kahi.cz/wordpress/wp-content/images/8/default-theme-folder-after.png

Same thought described more thoroughly, in 3 related blog-posts, in
context of WP: http://kahi.cz/wordpress/tag/theme-folder/

Chris J. Davis

unread,
Jan 31, 2008, 4:56:38 PM1/31/08
to habar...@googlegroups.com
Welcome to the wide world of Habari!

I am not sure I follow the logic of your naming convention. Could
you provide some more information? We are always open to hearing
about new ways to do things.

Kahi

unread,
Jan 31, 2008, 5:15:02 PM1/31/08
to habari-dev
Sure. I see template folder this way: there are files of a few "types"
- 1) pagetypes as home, single post, category, search results etc. -
their names are defined by core 2) additional, included files as
header, sidebars or separated forms. 4) page templates (I don't know
how is this called in Habari or if it even exists) 3) css files and
any other files.

My goal is to make this folder clearer - by way of grouping files of
same type (purpose) together. I think just prefixing is way that may
work.

Michael Bishop

unread,
Jan 31, 2008, 5:44:34 PM1/31/08
to habari-dev


On Jan 31, 5:15 pm, Kahi <kahi...@gmail.com> wrote:
> Sure. I see template folder this way: there are files of a few "types"
> - 1) pagetypes as home, single post, category, search results etc. -
> their names are defined by core 2) additional, included files as
> header, sidebars or separated forms. 4) page templates (I don't know
> how is this called in Habari or if it even exists) 3) css files and
> any other files.
>
> My goal is to make this folder clearer - by way of grouping files of
> same type (purpose) together. I think just prefixing is way that may
> work.
>

Not sure what page templates are. All Habari related templates,
afaik, must reside in the theme directory. Anything else could be in
it's own directory, ie, /includes, /css, /scripts, /images

Are you suggesting the Habari files be split into directories?

~miklb

Sean T. Evans

unread,
Jan 31, 2008, 6:52:44 PM1/31/08
to habar...@googlegroups.com
I think I see what Kahi is getting at. At a glance, there's no way to
tell what a file does in the theme directory and where it comes from. We
have files that are required, but there are many optional files. For
example, we allow that if you have a page with the slug "archives" you
can give it a custom layout by including file in your theme directory
page.archives.php. I think what Kahi is suggesting is extending that
structure so that items like sidebar.php would become inc.sidebar.php
and home.php might be core.home.php.

I'm sort of making those up as I go, but I can see the utility in this
for people who regularly work with other people's themes. (Or several of
their own). I believe that as, other than the core files, the files are
generally called by the theme files, there's nothing stopping designers
from doing this with anything they add on their own (in fact, I may give
the idea a try myself on my next theme, as it makes a lot of sense to me.)

While I see the advantage to this, I think, other than the "core" files
it could be implemented without any changes to the existing habari
structure.

Kahi

unread,
Jan 31, 2008, 8:02:33 PM1/31/08
to habari-dev
On 31 Led, 23:44, Michael Bishop <miklb.onl...@gmail.com> wrote:
> On Jan 31, 5:15 pm, Kahi <kahi...@gmail.com> wrote:
>
> Not sure what page templates are.  All Habari related templates,
> afaik, must reside in the theme directory.  Anything else could be in
> it's own directory, ie, /includes, /css, /scripts, /images

WP allows to create two types of main content - classic time-based
blogpost and time-independent Pages. There is always a default Page
template but you can also create it's modifications and set every Page
to behave by an individual template. It's almost forgotten
possibility, people like widgets, all-doing plugins and template files
are directly modified less and less frequently.

With files I have meant php files before all, Sean T. Evans explains
it well, see below please...

> Are you suggesting the Habari files be split into directories?
Not necessarily. It would also work

On 1 Ún, 00:52, "Sean T. Evans" <se...@morydd.net> wrote:
>
> I think I see what Kahi is getting at. At a glance, there's no way to
> tell what a file does in the theme directory and where it comes from. We
> have files that are required, but there are many optional files. For
> example, we allow that if you have a page with the slug "archives" you
> can give it a custom layout by including file in your theme directory
> page.archives.php. I think what Kahi is suggesting is extending that
> structure so that items like sidebar.php would become inc.sidebar.php
> and home.php might be core.home.php.
>
> I'm sort of making those up as I go, but I can see the utility in this
> for people who regularly work with other people's themes. (Or several of
> their own). I believe that as, other than the core files, the files are
> generally called by the theme files, there's nothing stopping designers
> from doing this with anything they add on their own (in fact, I may give
> the idea a try myself on my next theme, as it makes a lot of sense to me.)
>
> While I see the advantage to this, I think, other than the "core" files
> it could be implemented without any changes to the existing habari
> structure.

Yes, you are right, much difference will make just only prefixing core-
independent files. I'm practicing this while creating WP templates, as
this screen describes: http://kahi.cz/wordpress/wp-content/images/12/reordered-theme-folder.png
. But I would say that with help of core the tidiness will grow even
more. Then the "tidiness" in theme folder would not exist only
optionally, but by default.

Michael Bishop

unread,
Jan 31, 2008, 8:24:57 PM1/31/08
to habari-dev
I'm confused. Habari can use page templates, but they'd all start
with page, ie, page.foo., that in itself is a prefix of sorts.
Likewise for entry, ie, entry.single.

If you look over the Template File Hierarchy page in the wiki,
http://wiki.habariproject.org/en/Template_File_Hierarchy, you will see
how it works.

I don't see the need to add additional prefixes, and as I mentioned,
if you want the non-template engine files out of the root theme
directory, create an inc, include, extra-stuff directory, and include
from there.

just my 2¢ US

~miklb

Kahi

unread,
Jan 31, 2008, 9:52:51 PM1/31/08
to habari-dev


On 1 Ún, 02:24, Michael Bishop <miklb.onl...@gmail.com> wrote:
> I'm confused.  Habari can use page templates, but they'd all start
> with page, ie, page.foo., that in itself is a prefix of sorts.
> Likewise for entry, ie, entry.single.
>
> If you look over the Template File Hierarchy page in the wiki,http://wiki.habariproject.org/en/Template_File_Hierarchy, you will see
> how it works.
>
> I don't see the need to add additional prefixes, and as I mentioned,
> if you want the non-template engine files out of the root theme
> directory, create an inc, include, extra-stuff directory, and include
> from there.
>
> just my 2¢ US
>
> ~miklb

I see. But I didn't suggest that modification only because of myself,
but also because of everybody else. I think people will start creating
themes after existing models that similarly to usual wordpress state
mix files of all purposes together, what I consider as little bit
messy. You probably don't...
Reply all
Reply to author
Forward
0 new messages