Save Time With Development Templates
August 11, 2007 – 4:19 amWhether I’m creating a small 10 page web site or just some documentation for myself, templates save me time. I suggest that you create your own templates based on the resources below and integrate them into your workflow.
Directory Structure
I suggest that you create the following directory structure in an actual directory or store it in an archive. Create a script that creates a copy of this structure in your working directory where you will create a web document. You will be filling in this structure with a few files from the later sections.
./assets
./assets/images/
./assets/docs/ # any documentation should go here
./assets/downloads/ # you may want to have sub directories for public and private
./assets/stylesheets/ # home for your .css files
./assets/scripts/ # home for your .js files
./assets/flash/
./assets/sources/ # you may want to have sub directories for the types of sources
# you usually work with
./assets/modules/ # frequently used scripts in the language you prefer go here, for
# me thats PHP.
./assets/database/ # store your database schema here
Favicon
Create a default favicon that brands yourself and place it in the root of the above directory structure. This site will help with creating one.
XHTML
You will need to have a skeleton XHTML file that you will name index.html and place in the root of the above directory structure. I suggest that you use the templates here. Each of the three XHTML templates there will come in handy.
CSS
The above link to the XHTML templates also have corresponding CSS templates. I suggest that you append this one for color testing.
SCRIPTS AND MODULES
I like to separate the header and footer into a module (when I say module I’m talking about a PHP file). In that case you create another template file, index.php and place that in the root of the above structure. The header and footer would be included in the module and only the body would be present in the index.php file.
Common functions you use on a normal basis should be put in the .js and .php files. For example, database connection.
Share your starting template environment below.
6 Responses to “Save Time With Development Templates”
I’ve become lazy — the past few projects were done in CakePHP. Its actually nice to not have to code so much
But, for smaller projects I use a similar setup — only mine consists of:
/.htaccess >>mod_rewriter to index.php
/index.php >>which handles the routing
/jslib
/css
/images
/lib >> php classes which i’ll use
/sections
/sections/controller/action >> type of setup which is auto-routed by index
(the rest is in hidden directories like .sql, .doc, .scripts since nobody really needs to see those except svn :))
similar in style to cake/RoR, but way less powerful.
By rob on Aug 11, 2007
Good call, a standard directory naming scheme is crucial for rapid development, its like a map for your brain to find information, and if you change the layout you’re going to get the wrong directions. You should also look into HTML Microformats to further expedite development.
By Matt Foster on Aug 11, 2007
Nice one, symfony, cake and trax are good too:)
By Gary on Aug 11, 2007
I personally like to keep things a little more organized so i create a dir called inc and have inc/css; inc/scripts; inc/php to house all of the included folders. it makes for a more organized root dir. Good article, though!
By cityzen on Aug 12, 2007
Personally prefer to keep the modules directory just below the root of the html. Its just incase someone fancies going to example.com/include/db.php and gets a little bit of information they shouldn’t.
By Steve on Aug 13, 2007