Posts Tagged ‘alternative’

Displaying HTML Web Page Text in a Specific Font Style

Sunday, July 13th, 2008

The FONT tag is used to display your text in a specific style.

Although you may specify the font style you would like your text to be displayed, please keep in mind, if your visitor doesn’t have the font face you specify on their computer, the text will be displayed in the users default font setting.

To make sure your pages are being viewed as you intended, you should include alternative fonts within your HTML web page font tag.

<FONT face=”Verdana,Helvetica,Arial”>Your Text</FONT>

The code above tells the browser to display your text in Verdana, but if your visitor doesn’t have Verdana to display your text in Helvetica and so on.

By including font alternatives, you can ensure your page will be displayed exactly as you had intended.

PHP:Use Less PHP And More HTML With Alternative Syntax

Monday, June 30th, 2008

When PHP is tightly intertwined with HTML it can be awful to lay your eyes upon. Many years ago, while with a previous employer, the development staff and I believed it was a sin to use straight HTML in PHP files. We believed every file ending in a .php extension could only contain PHP. In retrospect, I don’t know why we ever did this, but I have seen other groups adhere to such rules as well. This style made what should have been simple HTML far more complex that it had to be.

Over the past few years the style in which developers are writing PHP to output HTML has shifted quite a bit.

Example 1: No Alternative Syntax, and a Lot of PHP.

<?php
echo “<table size=\”100\”>\n”;
echo ” <tbody>\n”;

if($displayResults) {

while($row = mysql_fetch_assoc($result)) { ?>
echo “<tr>\n”;
echo “<td>” . htmlentities($row['id']) . “</td>\n”;
echo “</tr>\n”;
}

}

echo “</tbody>\n”;
echo “</table>\n”;

?>

This is typical to what I’ve seen in a number of PHP applications. Though this is a simple example, I am sure you can appreciate how this method of outputting mostly html can grow out of control. It requires significantly more developer brain power to determine the code’s purpose than the example below.

Example 2: Less PHP Paired With Alternative Syntax

<table>
<tbody>
<?php if($displayResults): ?>
<?php while($row = mysql_fetch_assoc($result)): ?>
<tr>
<td><?php echo htmlentities($row['id']); ?></td>
</tr>
<?php endwhile; ?>
<?php endif; ?>
</tbody>
</table>

Here in example 2 the same functionality is achieved by using PHP alternate syntax and less output statements. As you can see, this fashion of interweaving PHP and HTML can go a long way to increase code readability.

Managed Versus Unmanaged Dedicated Web Hosting

Thursday, June 26th, 2008

If you have a large and complex website that receives a lot of traffic you may find that shared hosting is limiting your growth and the capacity to serve your customers. It may be time to move on to dedicated hosting. Shared hosting involves placing many websites on one server. All sites share the resources of that server such as disk space and bandwidth. Dedicated hosting means that instead of renting space on a server, you rent an entire server for your sole use.

Dedicated web hosting is much more expensive than shared hosting because the cost of operating the server is not divided between various accounts. The advantages of dedicated hosting include the freedom to use the resources of the server as you please. There are many different dedicated hosting packages to choose from. Their prices depend largely on the physical setup of the server computer. Just as with your home computer, faster processors and bigger hard drives cost more.

Another factor influencing the price is whether or not the server is managed. Keeping a server running in top condition can be a time consuming task. A managed hosting service offers the support and expertise to maintain your server and to perform routine maintenance such as software upgrades. This kind of service can be a viable alternative to hiring your own staff to look after your servers. Managed hosting, however, can be a lot more expensive than unmanaged hosting.  Whether the price is justified depends on the complexity of your website and whether or not you already have people on staff who can look after the day to day operations of a server.

Unmanaged hosting, despite its name, does not really leave you entirely to your own devices. Most hosting companies will offer a certain level of support for all their dedicated hosting packages. This support of course includes hardware maintenance for things like hard drive failure and extra technical support may be available if you need help with configuration or software installation. You will probably have to pay for this extra support but hiring a tech on an hourly basis from time to time may be cheaper than going with a full managed package.

If you are considering unmanaged hosting check to see how much control you can have over the server hardware. If your server becomes hopelessly locked you should be able to perform a re-boot or to expect someone to do it for you with a minimum of delay.

As with any hosting package the value of a dedicated hosting service depends on the reliability and integrity of the hosting company. If your website has grown to the point where you need dedicated hosting you need a hosting provider that you can rely on to keep your site online as much as possible.

Whether you choose managed or unmanaged hosting depends on the technical requirements of your site and the ability of you or your staff to manage a server so that it is running at peak efficiency. If you prefer to have the re-assurance of having highly trained professionals looking after the server, go with managed hosting. If you or your staff can handle most of the maintenance chores, you would be better off with an unmanaged server.