Website Designers and Webmasters

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

By: Ashton Sanders

PHP – Finding the Width or Height of an Image

Dec 22 2007

Filed under: HTML,PHP,Website Design

Knowing the width, height, Image type or attributes of an image can be extremely useful.

I’ve used this once to make a line of images all line up on the bottom. I found out the height of the image and then added a margin to the top of the image to make the bottom of the image always be 300 px from the to. So if the height of the image was 140, I would make the margin on top of the image = 300-140.

Here’s the code to find the height or width of an Image:

<?php

list($width, $height, $type, $attr) = getimagesize(“image_name.jpg”);

echo “Image width ” .$width;
echo ”
“;
echo “Image height ” .$height;
echo ”
“;
echo “Image type ” .$type;
echo ”
“;
echo “Attribute ” .$attr;

?>

Enjoy,
Ashton Sanders

By: Ashton Sanders

Blogger vs WordPress – Remote Site

Nov 17 2007

Filed under: Blogging,PHP,Review

When I first started this blog, I did a little bit of research about blogs, and chose Blogger. Now that I’ve been using Blogger for almost a year, I’ve started another blog, about Mordheim, with WordPress, and here are my thoughts:

Blogger

Overview

Blogger is very simple and user-friendly. There is a reason they are the most popular: it’s extremely easy to set up a blog and write posts. They also have a lot of functionality.

WordPress

Overview

WordPress is a little more complicated, and it seems like you can do more with the additional complication. They also have a very user-friendly interface and simple layout. WordPress has a larger base of fans who have created many blog layouts that are free to download. Because of this, WordPress’s Free Layouts are much nicer, stylish, better.

Blogger

Remote Blog

Unfortunately, if you want to put your website on a remote server (any other website besides “*.blogspot.com”), you lose almost all of your functionality. You don’t even get a Category Roll. The Categories listed on the right side of this blog is done manually. (The post count is also done manually).

WordPress

Remote Blog

Fortunately, WordPress.org supplies you with a free download of WordPress, and easy installation instructions. In 5 minutes, you have a new, stylish and functional blog hosted on your PHP website. They have a lot of functionality, and each free blog layout has different amount of functionality. You could probably spend the rest of your life trying out different blog layouts. If you are a PHP programmer, it is very easy to sink into the code and make lots of changes to the functionality. From making the categories display alphabetically, by ID, etc.

I would definitely recommend WordPress over Blogger for advanced users who are looking to host their blog on their website.

Blogging For Life,
-Ashton Sanders

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

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

« Newer PostsOlder 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