My New Wordpress Theme

Blogging, WordPress 23 Comments »
Wordpress - PHP+MySQL Blogging Web Application

So we all know that Wordpress had a recent update that was also required to fix some security issues. One of the issues that caught my eye was the fact that the default theme had a security vulnerability. After reading that I decided that although I did update Wordpress and the problem default theme files, I wanted to get off a theme that potentially could have other security issues if they are just now catching this one. My theme was not strictly the “default” theme, I had done a few appearance changes here and there that made it my own, however, all that back-end code was still the default theme.

So, me still never having any time to design my own theme, I decided to work with a theme of a designer that I have a lot of respect for. I decided to work with the GlossyBlue theme designed by Nick La, located on his N.Design Studio website. It gave me a great “template” to start off of to make it my own. He has such a great set of icons (small gifs) within his themes that just make your page look great.

Making it My Own:

ReformatThis Redesign Example

So as you can see by that example picture above, the left side is what this theme looks like by default and after all the image and css changes, what I have made it look like. All and all it was about 45 minutes worth of work to “Reformat” it to my liking. For such a drastic color change there were quite a lot of image adjustments and edits that I had to perform as well as quite a bit of standard css edits. Really not a big deal though. Even though it was already a great design to start from, I do like it much better now! One of the things I just had to do right away was clean up that HUGE HEADER! :smile:

So after all the image and css edits, I plugged in all the plugin coding where needed for all the plugins I use. Bob’s Simplistic Navigation suited this theme quite well since there were no single navigation page links coded into it. So always remember, if there is a theme that you come across that you really like but aspects of it do not fit you, well if you know some basic coding you can really dig in and “make it yours” like I have done here.

If you have not already been to Nick’s N.Design Studio website, you are really missing out. This guy is an amazing graphic artist and to top it all off, takes the time to show you some things you can do. Check out his tutorials that he offers and browse other parts of his site. With his more recent iTheme Wordpress Theme becoming so popular (you can see it on Saman’s site), he had troubles keeping his site up after all the Diggs.

So you tell me, what do you think about the new ReformatThis look…thumbs up?…thumbs down?…comments?…compliments?…original better?…free money? I will take either or all…

23 Comments »

PHP: Using switch() instead of if() + elseif()’s

PHP Friday, PHP+MySQL 3 Comments »

It’s PHP Friday!
The PHP Friday Series

It makes for much cleaner code if you use the switch statement rather than if() followed by multiple elseif() statements. I have read many performance tests articles and switch() does process faster over if() + elseif()’s. But how does it look? How do you code it? Well below are some examples.

First, lets set a variable just to have it as an example:

1
$example_var = 7;

Now in most apps, you have most likely seen something similar to the following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
if ($example_var == 1) {
	// action 1 code here
}
else if ($example_var == 2) {
	// action 2 code here
}
else if ($example_var >= 3 && $example_var < = 6) {
	// action for 3 thru 6 code here
}
else if ($example_var == 7) {
	// action 7 code here
}
else {
	// for any other value do this
}

Those very same options can be coded into a more efficient switch() statement as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
switch($example_var) {
	case 1:
		// action 1 code here
		break;
	case 2:
		// action 2 code here
		break;
	case 3:
	case 4:
	case 5:
	case 6:
		// action for 3 thru 6 code here
		break;
	case 7:
		// action 7 code here
		break;
	default:
		// for any other value do this
		break;
}

or as another switch() statement alternative that gives you an interesting perspective or way of looking at it:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
switch(true) {
	case ($example_var == 1):
		// action 1 code here
		break;
	case ($example_var == 2):
		// action 2 code here
		break;
	case ($example_var >= 3 && $example_var < = 6):
		// action for 3 thru 6 code here
		break;
	case ($example_var == 7):
		// action 7 code here
		break;
	default:
		// for any other value do this
		break;
}

As you can see by that last example, making the value in the switch() function to true or false and then loading switch cases that involve statements that are either true or not work just the same.

Summary:
So the variable enclosed in the switch() statement is what you are comparing its value to all the possible cases in the switch() statement that you have assigned. You assign each case a value or operation to see if its result matches the value of that variable. Everything located under that very case will be performed until it reaches the break statement letting it know to stop. Multiple cases can be brought together to all include the coding below it. It will keep performing all code below a matched case so long as a break statement is not met. default is the equivalent basically of just else. Its basically the "catch-all" and will always perform in the event that no other case above matched and had a break placed below it.

Definitely check it out over there on the wonderful packed full of information -> php manual:
PHP Manual: switch()

In the end, switch() may seem to be a little more difficult to code if you are not used to it, but if you look, it is a much easier code to read and know exactly what is going on. If the speed/benchmark tests that I have read about are true, than of course you want to use switch() as your primary function for this sort of coding anyway.

3 Comments »

Bob’s Simplistic Navigation *UPDATE*

Blogging, WordPress 5 Comments »
Bob's Simplistic Navigation

I requested my plugin to be added to the Wordpress Repository back in April when I created it. I heard back yesterday that this request was approved. Upon hearing that, I decided to upload my plugin to the official repository and now “Bob’s Simplistic Navigation” is available straight out of Wordpress Repository! I am hoping that this will very likely up its exposure and usage. Its so great that such a simple plugin can be so useful to many people.

“Bob’s Simplistic Navigation” the plugin has a home here located at:
http://blog.reformatthis.com/plugins/bobsnav

Or you can go view the Wordpress pages for it by clicking this image below. So go on and check out the Wordpress plugin page, if you look real hard, you may notice I mentioned a few people in the plugin documentation:

Wordpress Plugin Screenshot

5 Comments »

Chris Shiflett – PHP Hero

Heroes, PHP Friday, PHP the Language Cards, PHP+MySQL No Comments »
PHP the Language: Chris Shiflett

Its PHP Friday!
Long ago, when I was discovering the language of PHP, I was very interested in finding out the security issues that I may come across and things I can do to prevent them. There is a name that is basically synonymous with security in PHP, and that name is Chris Shiflett. Chris wrote the O’Reilly book “Essential PHP Security” in 2005 which is often referred to in many security articles and posts. Chris has also contributed to many other PHP publications.

One of his biggest contributions to the PHP community is the PHP Security Consortium that he founded. This Consortium houses many key projects including the highly recommended: “PHP Security Guide” free to download and a must read.

I want to close this by saying, if you choose to code a web language, you need to take responsibility and learn how to code securely. Nobody is incapable of mistakes, but you need to absolutely do your best to code secure applications. Security needs to take the front seat and always be in your mind when coding an application. The first step to preventing bad code is education. Read articles, books, and warnings. There are many very common mistakes that you can educate yourself on how to prevent.


“PHP the Language” Playing Cards Credits:
The overall card design is based off of the card playing game Magic the Gathering
“Poker” style cards have already been created – Check Them Out

Chris Shiflett Card Credits:
Original image located here: georges flicker
Chris quote found here: RioSec: Chris’s Quotes

Chris Links From Card & Elsewhere:
http://www.shiflett.org
http://www.phpsec.org
http://www.brainbulb.com
http://omniti.com/people/bios/chris_shiflett

No Comments »

Rasmus Lerdorf – PHP Hero

Heroes, PHP Friday, PHP the Language Cards, PHP+MySQL 5 Comments »
PHP the Language: Rasmus Lerdorf

Quick Bio:
PHP started out as a personal project of Rasmus Lerdorf. Originally called “Personal Home Page Tools”, PHP’s first 2 versions were authored by Rasmus. Future versions have been core developed by many, but of course Rasmus is still well involved in development and the community. He is currently employed by Yahoo, an extremely PHP friendly employer. This offers him much opportunity to still be quite active in all areas that are PHP. He is constantly invited to conferences around the world. I have read and heard many times, if you choose to code PHP, you need to know the name Rasmus Lerdorf. You need to know PHP’s history and you need to know the man who originally brought it to us.

Being extremely security savvy, Rasmus decided to point out a security flaw in every single Open Source CMS program when invited to speak at OSCMS 2007. In a recent podcast, I remember hearing Ed Finkler, a key php securing developer and member of the PHP Security Consortium, saying that he would never show code around Rasmus, too scared what Rasmus would point out. Rasmus will not hold himself back anywhere when he sees a insecure application, it could be mid-conference and he will out you. I really like this about him, doing all he can to improve PHP’s overall security. For instance, if he ever commented on this post, he would probably tell me to stop using Wordpress ;) Wordpress is PHP based, but it has a wide and long history of bad coding and security flaws.

Rasmus was the first big name I heard in the PHP community when I started to get involved in it years ago. There are many big names now and loads of developers out there doing very important things, so I will be able to write many of these, but let us never forget this first one. Rasmus, the man who started it all! Thank you Rasmus!

Its PHP Friday!
The first here at my blog. In an effort to knock the dust off my blog, I wanted to create a standard that I will do my best to live by. Every Friday I will be posting some kind of PHP related post. It is only appropriate that the first PHP Friday post be on the first PHP developer. I have just been so incredibly busy working at work and home. However, what I am busy with is coding PHP. Because of this, I come across interesting PHP items all the time. As you know from my previous posts, the PHP movement and community means a lot to me. So I also have a lot of heroes in that community that I would like to write quick bios about and even create these silly cards for. Its been many years since, but as a young teen I was really into the card playing game “Magic the Gathering”. I thought these card layouts would be kind of a cool way to honor some of my PHP Heroes.


“PHP the Language” Playing Cards Credits:
The overall card design is based off of the card playing game Magic the Gathering
“Poker” style cards have already been created – Check Them Out

Rasmus Lerdorf Card Credits:
Original image located here: chrys flicker
Rasmus quote found here: Matt Wade Article

Rasmus Links From Card & Elsewhere:
http://www.lerdorf.com/
http://blog.360.yahoo.com/rlerdorf
http://toys.lerdorf.com/

5 Comments »
"Reformatted", but based on a WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in