No, I'm not dead yet =)

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 ($in as $key => $value){
			$in[$key] = ss_($value); // <= Reference to itself, recursion!
		}
		return $in;
	}elseif(is_string($in)){
		// Regular stripslashes
		return stripslashes($in);
	}else{ return null; }
}

Comments say it all, really.
Just another quick example would be a countdown function:

 
function countdown($num) {
	echo $num, '<br/>';
	if ($num == 0) return false; // 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);
 

That all for now, folks.



Posted in Miscellaneous at July 31st, 2008. 10 Comments.
The Cronjob Interface

The Cronjob Interface

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...

Tutorial on Cronjobs will follow :-)



Posted in Miscellaneous at July 21st, 2008. No Comments.

You'll never guess what I've made now! :).

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!

Click

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 ?

Thanks for reading.



Posted in Miscellaneous, Web development at July 20th, 2008. 1 Comment.

Ever wanted nicely styled CSS tooltips?

Here's a quick explanation:

 
<a href="#">Link text<span>Your tooltip</span></a>

Use that HTML. Then add the following to your stylesheet:

 
a { position: relative; outline: none; }
a span { display: none; }
a:hover span {
display: block;
font-size: 8pt;
position: absolute;
top:-25px; left: -45px;
border:1px solid #383a47;
background-color:#5cbbe3;
color: #383a47;
text-align: center;
padding: 1px 5px;
width: 130px; }

This code hides the span tag when you're not hovering over it. (a span { display: none; }) and positions it nicely when you DO hover over it.
Read on for an example (just a single hyperlink, but it's not valid xhtml so I put it on a different page)
Read More...



Posted in Web development at July 19th, 2008. 1 Comment.
The steps I took for designing my new layout

The steps I took for designing my new layout

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!



Posted in Miscellaneous at July 18th, 2008. No Comments.