I've still been working on the WP Theme Generator, which nobody is using. I found that my webhost has the php setting for adding slashes turned on by default. My code relied on having no slashes. To fix this, I had to write a short recursive function, which I'll share here, and then explain.
Recursion, it's just a fancy word for a function, in which it calls to itself. Like function a() { a(); }. That would provide an infinite loop, but it's the most simple recursive function.
So, my situation, the $_GET and $_POST vars had slashes added. And I wanted to strip them out, but I would like my function to accept both strings and arrays, for sake of convenience and consistency (always use my function, instead of sometimes stripslashes()). What I wrote was this:
function ss_($in){if(is_array($in)){// It's an array, loop through all the keys and strip them.foreach($inas$key => $value){$in[$key] = ss_($value); // <= Reference to itself, recursion!}return$in;
}elseif(is_string($in)){// Regular stripslashesreturnstripslashes($in);
}else{returnnull; }}
Comments say it all, really.
Just another quick example would be a countdown function:
function countdown($num){echo$num, '<br/>';
if($num == 0)returnfalse; // Stop countin at 0.
countdown(--$num); // --$num subtracts the one from $num before the value is read. $num-- does it after.return$num;
}
countdown(20);
I've just set up my very first cronjob, to take out the trash of the theme generator. So here's a warning, if you're creating a theme there sunday morning around 3.00 am, or wednesday morning around 3.00 am, you have a chance your files are going to be deleted midway through your process..
BAWWWWWWWWW...
A theme generator, which takes in regular templates (all HTML), and turns them into a 'basic' template, with a widget-ready sidebar, archive support, comments, and what not!
Please let me know what you think in the comments section. And, please; Do note that this is a beta version, hmm let's make up a number. Let's call it version Oh-point-six ?
I'm personally not the creative type, being original with design is very hard for me. I just can't think of that special thing to do to make a design unique. So the thing I did was: sit down, pull out a sketchbook and a pen. And just draw a regular layout. Then switch some things around, and you have a general layout to work with. This is what I came up with:
That's what my next layout (which will be a wordpress theme) will look like, at least, that's what I'm aiming for.
So I'll be focusing on that, using photoshop. I'll be sure to keep you updated.
One more thing: Cypher. An online text-based hacking game. By clicking that link and signing up, you're selecting me as the referrer so you'll be making me 100 credits! Woot!
Like the rest of all the Wordpress users, I've upgraded to 2.6. I was one of the first too, updated about ~10 minutes after the release! Here's a little demo, from the wordpress website:
I find that the Theme Viewer does its work great :). And it's nice to have the plugins sorted instead of having activated and not activated randomly in between.