It's common sense to name things based on meaning -- search, sitemap, home, basic-page / default etc. -- but I'm interested in hearing if you folks are defining / following more specific rules than these. This is something I've been thinking quite a bit lately and unfortunately I feel a bit lost here.
IMHO this becomes an important thing especially when you have multiple developers working on / providing support for same projects, which they aren't necessary familiar with. It's one of those things that make it easier for a new developer to jump on board of a project and instantly understand what's happening under the hood (or at least make educated guesses.)
So after this (longish) explanation, I'd really love to hear what you think about this subject -- what kind of naming conventions do you apply for your templates and/or fields? (If any.)
2 replies to this topic
#2
Posted 24 May 2012 - 12:45 PM
Well.. after template specific field settings the need for new fields have been much less and it is easier to use more generic field names. My usual projects do have all or some of these for example:
image
images
file
files
summary
body
date
datetime
tags (page field)
I also have some common template names used in many projects:
basic-page
home
members-home
events
event
news
news-item
I try to use what is given on demo template. Also, trying to keep all the field and template names In English. Nothing too special here, interested to hear about others.
image
images
file
files
summary
body
date
datetime
tags (page field)
I also have some common template names used in many projects:
basic-page
home
members-home
events
event
news
news-item
I try to use what is given on demo template. Also, trying to keep all the field and template names In English. Nothing too special here, interested to hear about others.
#3
Posted 24 May 2012 - 12:48 PM
It's common sense to name things based on meaning
Absolutely right. I tend to try for 'self-documenting' code, in other words (exactly as you say), naming things based on meaning. This is for templates, fields and other variables.
What I also do is use includes in templates for common page elements (which I am sure everyone does) and name them meaningfully. Also grouping template files by purpose is useful. For example, I'll name my includes inc.head.php, inc.foot.php etc, so they are grouped together in any list or file selector.
While I was writing, I see apeisa got in before me! I also try to keep things in English, but even for a native English speaker sometimes you wouldn't think I was!
Also tagged with one or more of these keywords: template, templates, convention
Community Support →
API & Templates →
Programmatically change page template in modulesStarted by boundaryfunctions, 11 Apr 2013 |
|
|
||
Community Support →
Getting Started →
One-off pagesStarted by jmart, 08 Apr 2013 |
|
|
||
Community Support →
General Support →
Templates LabelStarted by kongondo, 05 Apr 2013 |
|
|
||
Community Support →
General Support →
Calling an image field in a templateStarted by cmscritic, 03 Apr 2013 |
|
|
||
Community Support →
API & Templates →
Basic navigation by templatesStarted by luckybusted, 18 Mar 2013 |
|
|
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users













