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.

If you ever use floats, and then tried to add content to a container that's not floated, you may have experienced the same issues that many have. The solution is far simpler than expected

 
.clear { clear: both; }

This forces any item with a class of clear to be clear of floats on the left and right, which are - by chance - the other two options to clear; left and right. So after floating elements left and right, you should add a to force content below.



Posted in Web development at July 15th, 2008. No Comments.

Ever wanted to make an upload script, but don't want the page to refresh? Try AJAX.

In this tutorial we'll use an iframe to simulate AJAX behaviour.

Firstly, we "might" want to create a simple upload form:

 
<p id="f1_upload_process">Loading...<br/><img src="loader.gif" />
<p id="result">
<form action="admin/addpost.php" method="post" enctype="multipart/form-data" target="upload_target" onsubmit="startUpload();" >
		File:
<input name="myfile" type="file" />
<input type="submit" name="submitBtn" value="Upload" />
	</form>
 
	<iframe id="upload_target" name="upload_target" src="#" style="width:0;height:0;border:0px solid #fff;"></iframe>
 

The important part here is the enctype, always have the enctype specified if you're uploading files. The first paragraph is the little Loading... box that'll show up when we press the submit button. The second <p> "result" is to display the results (We've uploaded or We failed). And lastly the iframe that is actually submitting the data, specified through the target="upload_target" in the form. Also, the forms onsubmit triggers the startUpload(); function.

Now we want to add some Javascript functions:
Read More...



Posted in PHP, Tutorials at July 14th, 2008. 9 Comments.
 
$string = preg_replace("/(http:\/\/)?([a-zA-Z0-9\-.]+\.[a-zA-Z0-9\-]+([\/]([a-zA-Z0-9_\/\-.?&%=+])*)*)/", '<a href="http://$2">$2</a>', $string);

That little gem right there'll take any length of text and turn the urls in it into hyperlinks. Cool or what? :-)



Posted in PHP, Web development at July 13th, 2008. No Comments.