Build a quick template engine for your site
Apr 9, 2008 php
If you have a website with more than a few pages, you may want to consider using a template engine. Template engines allow you to edit one file on your site to make changes to your entire website. This comes in very handy when you wish to redesign your website, or just make quick changes site wide.
There are a few open source option you can use like Smarty that come with a lot of features. However the learning curve can be very long. So I will show you how to build a quick and easy template engine.
First I want you to create 4 files: index.php, header.php, footer.php, and nav.php. The first file “index.php” will serve as your main file; it will also be a template for all the other pages on your site.
Files header.php, and footer.php will serve as the top and bottom of your web pages respectively. The nav.php file will be used for your navigation section on your web site.
Now open the first file (index.php) in a text editor and add the following:
<?
// This will add meta info so every page can have it’s on meta tags
$PageTitle = “my page name”;
$PageDescription = “my page description”;
$PageKeywords = “my page keywords”;
?>
<?php include(”header.php”); ?>
<?php include(”nav.php”); ?>
Your main website contents would go here, of course you can use html tags anywhere in these files, just don’t use the within the PHP tags.
<?php include(”footer.php”); ?>
Next open the header.php file and add the following:
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<HTML>
<HEAD>
<TITLE> <?php $PageTitle ?> </TITLE>
<META NAME=”Keywords” CONTENT=”<?php $PageKeywords ?> “>
<META NAME=”Description” CONTENT=”=”<?php $PageDescription ?> “>
</HEAD>
<BODY>
Now open the nav.php file and place this code into it:
<A xhref=”index.php” mce_href=”index.php”>Home</A> <A xhref=”page2.php” mce_href=”page2.php”>Page2</A> <A xhref=”page3.php” mce_href=”page3.php”>Page3</A>
Now open the footer.php file and place this code in it:
</BODY>
</HTML>
Now save all these files and make 2 more copies of the index.php file. Name them page2.php, and page3.php. Add some contain to these pages so you can see the differences between the pages.
Upload them all to one directory on your server, and view the index.php file with your browser. If it works you should see a very simple page with links, and some text.
You can add more pages by updating the nav.php file, and adding another file based on the index.php file.
Another tip I should include is to use cascading style sheets (CSS).
If this all seem too much for you, consider a content management system (CMS). There is a large selection of them to choose from. My favorite is Website Baker.
One last word of warning, never include a file as a variable like this:
<?php include($MyFile); ?>
This will open a serious security hole that will allow users to include their own PHP files.
Popularity: 30% [?]
Tags: features
How Not To Promote
Sep 7, 2006 Marketing
How Not To Promote
I spend a good part of my day promoting my websites, and searching for new ways to promote them. And everyday I find a lot of really good ways ruin your site’s future success. Why you may ask? Well it’s really very simple, as you will see.
In this article I will outline several promotional methods that just do not work, or will cause you headaches later.
Click/Traffic Exchanges
On the surface these sites look great, and can bring many visitors to your site. However most of these visitors will have absolutely NO interest in your site. In fact these visitors will not even read your well crafted content. There only purpose for their visit is to get someone else to view their site.
The other disadvantage is lack of targeting. Even exchanges that promise targeted visitors, cannot possible achieve this. Simply put; 98% of the users are tiring to sell you on the newest promotion techniques, or get rich quick schemes.
Free-4-All Links
These sites used to be a good way to get your site noticed - when Matt Wright first invented the concept. It was meant to be a rewarding thank you for visiting a web site. But like most great innovations it quickly soured.
You will be hard pressed to find a free4all links page that does not require an email address - in which to spam your socks off. Or will you find one that will keep your site listed for more than a few moments.
Between the spam you’ll receive, and the fact that your site will only be listed for the time it takes you to get your first wave of spam, your link will have expired. Not only will it waste your time today, but you will be on the spammer’s list for the life of your email account.
Owning a free4all links page isn’t much better! Sure you may send your message to thousands everyday, but that message has little chance of review. Most submitters use a second “for spam only†email address or use a spam box. Sure, they may login to that account, but just to clean it out.
Your only achievement of owning a free4all links page will be your email address and server blocked and banded from your customers servers. They will not get your conformation email when you send them with the details of their order.
Link Trading/Reciprocal Links
If you’ve owned a site for awhile you have no doubt received emails asking for a reciprocal link. In other words I’ll put a link on my site to your site, if you do the same for me. Take a look at these offers skeptically and you’ll find the offer is not quite what it seems.
First for the link to do you any good, it should be on a site that is related to your site. Would a link from a site that sells eggplant seeds send you qualified leads/clicks for your electronics website?
The second problem with this offer is the site offering the link, usually has a directory somewhere on his site that your link will go into. Most of the time they will have a link on their front page to that directory which few people will view.
You will often hear the term “Page Rank†when offered a link trade request. Try not to put much weight on this ideal. Sure, page rank is important, however it will not help you sell your good or services if your page rank is built sloppily. Your links must be on relevant sites in order to be of any benefit.
Safe List
Safe list marketing attracts a large portion of internet marketers. They are sold as a tried a true way to market your services. At some point it may have been, but not anymore. When you sign up for these lists they ask you for 2 emails addresses, one; your contact email, and the second; to receive ads for others using the safe list. What do you think happens to the ads you place in these safe lists? They never get read, so your speaking to deaf ear.
Safe lists come in many different forms. But they will all reveal the same results, a big waste of your time, and talent.
In Closing
Take your time to research promotional opportunities, and remember that good result come from hard work and time. There is no quick fix! Anyone that offers you immediate results is not offering you targeted visitors.
When you take your time to find real ways to get your target audience to your site you will be rewarded.
David Span writes on many different topics. You can learn more about him at his website http://DavidSpan.com Here you will find more of his articles.
Popularity: 7% [?]
Tags: features





