Theming WHMCS – It’s EASY!

After reading several people struggling to theme WHMCS, I decided that I would write a brief tutorial to attempt to emphasize how easy this is if you read the directions and think it through.  First off, modifying the default them is *not* the easiest way to do it, you’re going to beat your head against the wall trying.  WHMCS has setup their system very simply.  Imagine the following php file-

<?php
include(header.tpl);
include(maincontent);
include(footer.tpl);
?>

This is an oversimplified version of how WHMCS works.  So here are the steps

  1. Setup a static design that you would like to use.
  2. Split the file around the main content area
  3. Copy/Paste everything above the main content into the header.tpl file for your skin
  4. Copy/Paste everything below the main content into the footer.tpl file for your skin.
  5. Replace meta variables (these can be found in /templates/default/header.tpl)
  6. Use FireBug to fix any minor issues in your css.

WHMCS uses the smarty template system.

After 4 years of waiting….GRADUATION! :-)

Some of you may have noticed that my blog has recently been rather…inactive?  Well, finals at the end of the semester were a bit rough, so I had very little time to get out and do things.  Today I graduated from the University of Central Florida with a BS degree in Information Technology. I’m not really sure what I can write about this, it’s seemed like a long 4 years at some points, and then others I wonder where the time has gone.  I got to attend the opening of our arena, football stadium, watch our football team work it’s way to our 2nd ever bowl game & first CUSA title, as well as see great academic marks as well, such as US News ranking UCF in the top 150 schools nationwide and placing them on the top 5 up and coming colleges.

Here’s a few photos from the ceremony and afterward.  Unfortunately they had to all be taken inside due to a heavy rainstorm that we couldn’t wait out due to having to return the gown within 2 hours of the ceremony being over.

Why I have zero tolerance for politicians who do not support the 2nd amendment

I typically do not post political things on my blog, but this is something I support everyone watching.  Those of you that know me, know that I believe illegal gun activity should come with the harshest penalties available under the law.  Furthermore, you know that my conscience would never allow me to vote for a politician who removes any form of an individuals constitutional rights, and I encourage everyone to take advantage of the rights that so many have died to defend.

This is by far the scariest YouTube video I’ve ever watched, but it proves a point.  We all have the right to vote, please do the right thing, give law abiding citizens who obtain a gun according to their local, state, and federal laws the right to defend themselves.  Use your rights.  If you own a gun, set an example, follow all laws and gun safety practices at all times!

**Warning, the audio transcript of a murder is in this video**

Formatting Phone Number and Fixing User Input With PHP

Recently I was writing a franchise module for a shopping cart software that required franchise owners to input their phone number.  I’ve ran into the problem where no matter what instructions I’ve given, the franchise owners consistently like to format the phone number in their own unique way.  Rather than add 3 text boxes to where they have to tab between every part of the phone number, I wrote a quick and easy php script to handle all the leg work for me!

[php]
//Input example
//(999)999.9999
//Output examples
//formatPhoneNum($phone_number, 1) outputs (999) 999-9999
// Inputting 999-9999 would cause the function to return “False”
function formatPhoneNum($phone_number, $style){
// Style 1 – (999) 999-9999
// Style 2 – 999-999-9999
// Style 3 – 999.999.9999
// Style 4 – 9999999999
$number = str_replace(array(‘(‘, ‘)’, ‘-‘, ‘ ‘), ”, $phone_number);
if (strlen($number) == 10){
$area = substr($number, 0, 3);
$first = substr($number, 3, 3);
$last = substr($number, 6);

switch($style){
case 1:
return “($area) $first-$last”;
case 2:
return “$area-$first-$last”;
case 3:
return “$area.$first.$last”;
case 4:
return “$area$first$last”;
}
// if the phone number was too long or too short
else {
return false;
}
}
[/php]