PHP - includes

PHP includes are only included if the logic in the script requires them.

I created three files:

top.php

Code

echo 'start<br />';
if (true)
  include 'true.php';
else
  include 'false.php';
echo 'end';

true.php

Code

$var=true; /* Valid, but meaningless statement */

false.php

Code

false /* Deliberate syntax error to see if the file was included */

When top.php executes, it does not report the error from false.php. This means placing include and require statements directly before the code which requires them allows you to create scripts that process only the files required to deliver the page.

One note: the performance improvement may not be worth the slightly more complex architecture. You may see improvements by using an accelerator, or both an accelerator and this architecture. This also requires more files, and the code needs to be modular.

Anyone can build a web site ...

… but to build a robust site in a timely manner which is cost-effective to maintain requires a fairly high level of skill, and careful management.

  • The best sites are built by teams.
  • The best sites usually have powerful applications behind them.
  • The best sites adhere to standards and coding practices.
  • The best sites have complex architectures that allow them to be managed efficiently.
  • The best sites meet the objectives of the customer and the results can be measured.
  • The best sites are delivered on time and under budget, successful for all parties.
  • The best sites mature and change, gracefully.
  • The best sites are monitored for reliability and security.

What does it cost to build a web site?

Alot! Most of it is time, and time is money. It can be very difficult to account for the costs, since they are not tangible objects.

First, you need a name - so you’ll have to spend the time to choose one and then register it.

Then, you need a server, for the site and for email (it may be the same server), a server is the computer that delivers the site. You can put one in your office, choose a hosting company, or let a company that builds your site handle the hosting. Each has its own costs and benefits. They are offered in decreasing levels of skill requirement, but increasing cost. This is a recurring cost, it will affect the reliability of the site and the cost of maintenance. It also affects the level of control you have over your site and system. You also need an Internet connection - and a high-speed connection to support a busy server may be very expensive.

The site has three main components, design, content, and logic. They can be provided by different organizations. If one company has many sites with designs you like - get an estimate from them for a design. Whether you purchase just a visual image or the HTML/CSS code must be specified. Content is often best managed by an application - either a blog or content management system (CMS). That can be done in house, with some training, or outsourced. The logic may be the blog or CMS. Don’t build one - buy it, or use an open source solution. Visit some sites and run through the demos, see if the person who will manage the content likes the applications as well. Integrating the application and the design should be done by a company with experience with that product. This applies to ecommerce solutions as well.

Be prepared to clearly state what you are trying to do. Try to stay focussed on that objective throughout the project, changes can be very expensive, for all parties. If you don’t have a clear objective, it may be better to wait until you do.

Use the Cache - Micro page overhead can be overcome with the browser cache

Although frames and iframes may require duplicate requests, most browsers will cache .js, .css, and .htm/.html files. This virtually eliminates the redundant request overhead, while still allowing a rich interface constructed from a page of micro pages.

This approach also avoids the complexity of AJAX/JSON. Done properly, it is completely transparent to the site visitor.

Business - Success

Any successful transaction relies on the following:

  1. Clearly defining the product or service to be delivered
  2. Understanding what it costs to deliver it
  3. Doing the work well

Easy mistakes:

  • Optimism - unrealistic agreements
  • Scope creep - allowing the product or service to change beyond what can be absorbed by the cost of delivery
  • Pursuit of perfection - failing to limit the delivery to what was agreed upon in an effort to do an outstanding job at the expense of the provider
  • Incompetence - inability of the provider to deliver due to lack of skill
  • Poor cost control - this begins with the estimate or price. It must reflect the actual cost to deliver the product or server. Through the entire project, those costs must be tracked to keep the project within the budget and provide data for future projects
  • Team failure - Failure of the team to work cohesively