Currently Browsing
ProgrammingRecently I had to use PHP to display a score value such as “3″ padded as “03″. There’s a tiny PHP function that does just this. $myvalue = ’3′; str_pad((int) $myvalue,2,’0′,STR_PAD_LEFT) While working with strings, such as $myvalue, I had to convert it to integer using the (int) operator so I can make further calculations [...]
One of my clients needed his online shop customers to be able to go back several steps with one click and keep the current session variables in memory. The obvious solution was the browser’s back button. But I couldn’t instruct the customer to click it one time or 3 times or 5 times. So I [...]
If, for any given reason, you are not able to implement a MySQL counter, here is the easiest solution for creating a flat file online users counter. Create a file called online.php, make it writable (either CHMOD 755 or CHMOD 777, depending on your server requirements), and insert the following code where you want the [...]
There are quite a handful of different post thumbnail solutions out there, but it seems that I found a very simple and compatible one that uses the famous timthumb library. Add this code to your functions page, functions.php: function post_image() { global $post, $posts; $thumb = ”; $output = preg_match_all(‘/<img.+src=[\'"]([^\'"]+)[\'"].*>/i’, $post->post_content, $matches); $thumb = $matches [...]
One of the latest features I’ve added to my sports fishing portal was the nice date feature. Instead of showing PHP formatted date and time, I wanted to display time since the action took place, like “4 hours ago”, “2 days ago”, “1 minute ago” and so on. <?php function nicetime($date) { if(empty($date)) { return [...]
May be old but it contains lots of jQuery tricks and tutorials links: http://technosiastic.wordpress.com/2009/09/24/collection-of-top-jquery-tutorials-tips-tricks-techniques-to-improve-performance/ JQuery plugin to rotate images made in pure Javascript + HTML5 <canvas> element and VML in IE: http://wilq32.googlepages.com/wilq32.rollimage222 Makes me wanna start up an online jQuery Particle Illusion: http://wilq32.blogspot.com/2009/02/wilq32particles.html http://wilq32.googlepages.com/Wilq32.Particles.html?text=Tycoon Looking to rotate some glitter animations I found this jQuery plugin. [...]
I’ve been working a lot these days to complete several big projects, and a handful of smaller ones. They’re all related to PHP and optimization. I’ve been thinking of a switch-based PHP preloading technique, which I’m trying to implement in a couple of projects. What I’m trying to do exactly is update my CMSs and [...]
Like I promised in a previous post, here is the code required to show latest 5 posts followed by 15 more, like on my homepage. You need to edit the index.php template and add 2 sub-loops separated by wp_reset_query(). Simple as that. Here is the entire index.php code (you should be able to pull the [...]
While looking at my current theme bugs (Whiskey Air), I decided to take the next step and turn it into a full HTML 5 template. So, after reading a bit of HTML 5 literature, I started changing the theme, bit by bit. I will release it free after doing all changes. I might even to [...]
I’ve been playing lately with the C programming language, as I’m building some modifications to a game engine (it’s a private project, yet). Cprogramming.com helped me finding some solutions to some common problems (I’m a beginner). Maybe it’ll help you, too.