Monday, October 19, 2009, 10:04 AM Code by (Article #246)
Something I've always been a bit dubious about is the tendency among web programmers to always favor speed. Now, I understand the need to avoid having giant loops of JavaScript code bogging down everyone who owns less than a Core i7. What I'm talking about is particularly that microsecond of server response time that many programmers refuse to sacrifice in the name of massively greater convenience.
I run all my websites off a single template file. That file has pseudo tags for things like the header, footer, sidebars and main content. Then, in PHP, I use regular expressions to fish out those pseudo tags and replace them with whatever dynamic content needs served to fill in the page properly. Advertisements
For you have something in the template file that looks like this (replace the brackets with lt and gt tags as needed):
[div class="content"] [CONTENT] [/div]
And the PHP code is going to look like this:
ereg_replace("[CONTENT]", $output, $template);
Is this is the swiftest approach? No. I probably wouldn't recommend running a website that gets 1 million hits a second this way. But, the vast majority of websites don't get 1 million hits a second. In fact, the majority don't get 1 million hits a day.
From my perspective, it's easier to build for convenience than it is for speed. Especially if that microsecond of response time doesn't win you much. I'd rather use template system that can be ported rapidly from website-to-website than a highly responsive system that requires serious digging to alter anything.
Also, frankly, when I look at the most widely used systems, such as Drupal, Wordpress and Joomla, my first thought is that they are coded neither for speed nor convenience. They're not easy to tweak. They're not peculiarly fast -- I mean, when you consider how many database calls the average Wordpress post requires just to serve a page -- ouch.
|
© 2010 Pro Content and Design. All rights reserved.
|
Tools
Check Google PageRank
Recent articles- Did the July PageRank update come early?
- Servers handling "Pending Delete" .COM domains failing
- Photoshop CS5, first impressions
- Google PageRank toolbar updates coming today
- To Microsoft's credit
- Tracking expiring and dropping domain names
- GoDaddy finally cleans up its checkout process
- Back to basics: clean up your link names
- What the internet will look like in hell
- Early release of expired domains is rare
Welcome!
Wonder where to start with your web design business?
This blog follows along with my efforts to build and grow a website design business, Pro Content and Design.
The goal of this blog is to fill in blanks that may be empty as you get your business rolling.
This blog, particularly the source code section, is not intended for beginners. If you are not comfortable with databases, Ajax, DOM objects and other advanced methods, I strongly suggest you go take a look over at W3 Schools before even reading -- let alone tinkering with -- any of the code here.
I hope this blog has some value to web designers as they attempt to get their businesses going.
Good luck, and happy reading.
Thank you,
John Crawford
Pro Content and Design

Books
I highly recommend Art of the Start if you have no idea where to start with marketing.
Links
Coding
W3 Schools
IBM's Mastering Ajax Series
Graphic Design
Worth 1000
Stock.XCHNG
Urban Fonts
Website Software
Apache Web Server
SquirrelMail
PHP/Zend
Website Design Issues
Non-Standard Character Guide
Google Trends
Search Engine Optimization Analyzer
Business
Guy Kawasaki's Blog
Seth Godin's Blog
Freakonomics
Computers
NewEgg
My Main Website
Pro Content and Design
Websites I have built
PunxsyPage: local free classifieds website
Farm N Land: low-cost real estate listing website
Groundhog Festival: for the local summer festival
Weather Discovery Center
My Webapps
TV Stations Transmitter Database
Google PageRank Checker
|