Website Designers and Webmasters

Dedicated to all the tasks Webmasters, Website Developers and Website Designers find themselves facing.

By: Ashton Sanders

Content Management System for Websites

Nov 12 2007

From my years of working on the internet, I have come to realize that the one thing that almost all of my clients desire, is the ability to manage their own website. This way, they never have to wait on their web guy to change a phone number on their website. If they have a new product, they have the ability to add it to their own website.

Because of this huge demand for a CMS for websites, we have developed one that I call “Database in a Flash.” This Content Management System is a very user-friendly program that uses MySQL and PHP. It allows anyone who knows a little bit about the internet to communicate with their MySQL database to update their website.

It really is an amazing program. For more information, feel free to contact us.

-Let me know if you have any questions,
-Ashton Sanders

By: Ashton Sanders

.htaccess – PHP on HTML/HTM Pages

May 29 2007

Filed under: htaccess,HTML,PHP

I went into more detail about what the different processes are of adding php to a website programmed with *.html pages in this earlier htaccess post.

Here are a few more .htaccess lines that will enable php on your server. (Different servers require a different line of code.)

AddType application/x-httpd-php .html .htm

AddType x-mapp-php5 .html .htm

AddHandler application/x-php .html .htm

AddHandler x-httpd-php5 .html .htm

AddHandler x-httpd-php .html .htm

Check out my other .htaccess posts.

-Ashton Sanders

By: Ashton Sanders

.htaccess – AddHandler

Apr 19 2007

There is a very common problem when trying to upgrade sites made by “newbie” website developers or when you realize that html isn’t the only language on the internet, and you need to upgrade your site.

Problem:

You have a site where every page has a *.html or *.htm extension, and you want to add a dynamic, server-side programming language like PHP.

Solution #1:

Go through your entire site, and change every file name to a *.php extension. Then go through every page and correct all of the hyper links. Then do testing on your entire site to ensure that you haven’t missed any links. Also, if you know anything about search engine optimization and websites, you’ll know you need to create 301 redirects from your old pages to your new so that you don’t lose any Rankings you may have gained. Then you have more testing to do to make sure all of your 301 redirects work….

Solution #2

Add this one line of Code into your .htaccess:

AddHandler x-httpd-php5 .php .htm .html

That’s all it takes to add PHP to my html files?

Yep, that’s it. That little line of code has saved me hundreds of hours of work, and I’m sure it’s not as commonly known as it should be.

-Spread the Wealth
-Ashton Sanders

By: Ashton Sanders

PHP – Include the Same File from Different Folders

Apr 7 2007

Filed under: PHP,Website Design

This is a PHP tutorial to add advanced include templates to your site.

What you need to know

  • Basic PHP functions: include(); and the “for” loop.

Background PHP Information

It is a very useful thing to use a template on your site. Once I have finished designing a site, and converted it into XHTML/CSS, I then make two (or more) includes out of it: “header.php” and “footer.php”. Those two includes have everything that is the same on every page of the site. This allows me to easily add or remove a button, change the layout, etc. All I have to do is change one file, and the entire site is updated!

What’s the Problem?

If you know includes, you know that they must be relative paths, not absolute. (So if your page is in the pages folder (/pages/) and your header.php is in the header folder (/header/), you will need to write your include like this:

include(../header/header.php);

The problem arises when you don’t want to hard code every new page, in every new folder.

PHP Solution

Here is a simple for loop that will figure out what folder you are in, and put the appropriate number of “../”s to make your includes work:

<?
$folder = split(“/”, $_SERVER['PHP_SELF']);
$rootpath = “”;
for($count = count($folder); $count > 2; $count–){
$rootpath .= “../”;
}
include($rootpath . “include/header.php”);
?>

There you have it, some sweet, yet simple PHP.

-Enjoy,
-Ashton Sanders

By: Ashton Sanders

PHP 301 Redirect: Moved Permanently

Feb 28 2007

Filed under: PHP,SEO,Website Design

Through years of programming websites and Internet database software, etc. I’ve decided to work mostly with PHP. PHP is a server-side scripting language that helps to create interactive websites. It is very useful for creating dynamic pages. (Pages that have one format but fill in different information depending on what information it is given.) This is common in any online store. Every product has the exact same layout, but it has different pictures, and words.

A great thing about PHP is it’s free. It’s largest server-side scripting language competitor, Microsoft’s ASP, isn’t. The PHP syntax is widely used and is very similar to C and Perl.

If I ever have a question about PHP or need information, I always go to http://W3Schools.com. It’s also a great place for beginner programmers to get their foot in the door.

Here is how to us PHP code to make 301 Redirects:

301 Redirect: Moved Permanently
This code is for page redirecting. If you ever change a page name on your website, or take it down, you need to redirect that link to another page. This is because if you’ve had that page up for any period of time, the search engines like google.com or yahoo.com still think that it’s there. Or another site may be linking to it. This will save visitors from getting lost and never seeing your site when they cliked on your link.

Here is the PHP code:

<?
header(“HTTP/1.1 301 Moved Permanently”);
header(“location: http://websitedesign.websitesinaflash.com/”);
exit();
?>

301 Redirect to “www.”
This code I programmed because I wanted to make sure that whenever someone comes to my site, they come to the “http://www.websitesinaflash.com” (NOT: “http://websitesinaflash.com“) So now whenever someone types in my website name without the “www.” It will automatically redirect.

“Who Cares if there is a ‘www.’ in front of your website or not?
The biggest reason for this is so that search engines don’t index two version of the same page. For example, if a Search Engine’s bot find a link to my sight that doesn’t have the “www.” It will index the entire site without it. And if that happens, I’ll have two exact duplicates of my website.

“Wouldn’t that be a good thing?”
No. Search Engines will ding you if you have duplicate content. They see it as an attempt to cheat the system. I knew a man who changed the hosting and domain name for his website. But he didn’t take down his old site. After a couple months, his old site which had had 3-4 Google Page Rank, now had 0 (zero). He realized this and took down his old site, and after half a year, he was back to normal.

Here is the PHP code:

<?
if($_SERVER['HTTP_HOST'] != “www.websitesinaflash.com”)
{
header(“HTTP/1.1 301 Moved Permanently”);
header(“location: http://www.websitesinaflash.com” . $_SERVER['REQUEST_URI']);
exit();
}
?>

And there’s my two cents on 301 Redirecting with PHP.

-Enjoy
-Ashton Sanders

« Newer Posts
RSS

Where Am I?

You have found the semi-coherent ramblings of Ashton Sanders: a website designer, developer and webmaster. This is primarily Ashton's place to save notes about techniques and things that he learns in his never-ending conquest of the internet. Hopefully it's coherent enough to be useful to you too.

Subscribe:

Enter your email to get automatic emails whenever Ashton posts on the blog.

Email:

Advertisers:

Email Marketing $19/Month! OIOpublisher Learn how to make Money from Blogging Hillarious, High-Quality Shirts for $6/each Great Book Keeping and Invoicing Software Advertiser Here

Tags and Categories

Links

Blog Roll