Web Design Blog

This is where we store some of our Web Development thoughts, tips and tricks, just because we like to share.

PHP- Alternative To The Depreciated mime_content_type Function And Fileinfo Functions

You’ve probably landed on this page because you want to find the Content-type of a file by using the mime_content_type function. But when you tried using the function, you were returned with a PHP error because it’s a depreciated function (PHP 4). Then you may have tried to use the Fileinfo function (am alternative suggested [...]

20 Dec 2011 / 0 Comments / PHP Scripts, Tips & Tricks / by Maruf

How To Display Latest Tweet On Website

Here’s a really quick and simple way to display your latest Tweet on your website like the example below (the graphics obviously won’t appear, just the Tweet): 1 2 3 4 5 6 7 8 9 10 11 <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(function () { $.getJSON("http://twitter.com/statuses/user_timeline/USERNAME.json?callback=?", function(data) { $(".show_tweet").html(data[0].text); }); }); </script>   <div class="show_tweet"></div> Simply [...]

30 Nov 2011 / 1 Comment / jQuery Scripts & Helpful Snippets / by Maruf

Javascript – Get The Hash Tag Value From A URL

So, you have the following URL: http://www.example.com/page/#comment-12 You want to get the value after the hash tag (#), which is comment-12 The following Javascript code will help you achieve what you’re after: 1 2 3 4 5 6 7 8 9 10 11 12 13 14   <script type="text/javascript">   //check if hash tag exists [...]

02 Sep 2011 / 1 Comment / Javascript / by Maruf

htaccess- 301 Redirect Old URLs With Spaces

Here’s a quick and easy htaccess 301 redirect tip. So, you have a URL like this: http://www.example.co.uk/this is_a_file.html and you want to redirect it to: http://www.example.co.uk/this_is_a_file.html All you need to is quote the URL like this: 1 Redirect 301 "/this is_a_file.html" http://www.example.co.uk/this_is_a_file.html

23 Aug 2011 / 1 Comment / htaccess fun / by Maruf

jQuery- Show The Height And Width Of The Browser Viewport in Real-Time

Strange. I looked around everywhere for this code, and couldn’t find it anymore online. I simply wanted jQuery code that would show the height and width of the browser viewport in “real-time” I found plenty of code samples that would show the viewport size on page load/refresh, but nothing that would update live, as I [...]

28 Jul 2011 / 2 Comments / jQuery Scripts & Helpful Snippets / by Maruf

PHP- List All Directories/Folders From A Specified Location

This is a quick extension/counterpart to my existing blog post that explains how to List All Files In A Directory in PHP. But instead of listing all files, I’m quickly going to jot down how to list all directories/folders in a specified location. Someone had asked in the comments section how to do it, so [...]

20 Jul 2011 / 1 Comment / PHP Scripts, Tips & Tricks / by Maruf

htaccess- Hide File Extension

I only used this code for the first time last week, but seems to work pretty well. The same code is plastered all over the internet on various websites, so I’m only jotting it down for my own personal reference. Hiding File Extensions What this piece of htaccess code basically does is allow you to [...]

07 Jun 2011 / 1 Comment / htaccess fun / by Maruf

MySQL / PHP – Optimize MySQL Tables Script

The MySQL Optimize Table command will effectively de-fragment a mysql table; it’s useful for tables which are frequently updated and/or rows are deleted. Optimizing will will help with overall performance. I’ve quickly written a PHP script that optimizes all MySQL tables in a chosen Database. All you need to do is fill in the correct [...]

22 Apr 2011 / 0 Comments / MySQL & PHP / by Maruf

WordPress Excerpt Function Showing CSS #gallery-1

I had the strangest problem earlier. A client had reported that CSS code was showing on a category page, where only excerpts of a post should be showing. This is what it looked like: To cut a long story short, this issue was driving me insane, and I was frantically trying to pin down the [...]

05 Apr 2011 / 2 Comments / Wordpress / by Maruf

Javascript – Make Div Into A Clickable Link

From what I’m aware, you can’t make a div into a clickable link with just HTML. The only way I’ve ever known is by using Javascript. Open in new window Here’s how to make a div into a clickable link that will open the target URL into a new window. 1 2 3 4   [...]

30 Mar 2011 / 2 Comments / Javascript / by Maruf

Simple JQuery / PHP Image Gallery

I previously wrote a Simple, Pure CSS Image Gallery. But times have changed since then, and now everyone seems to be keen on AJAX technologies. So I’ve written a nice and easy Image Gallery script that uses JQuery (and a small bit of PHP). The problem with the CSS image gallery is that different browsers [...]

27 Mar 2011 / 0 Comments / jQuery Scripts & Helpful Snippets / by Maruf

PHP – Changing Date Format

A friend of mine has been struggling to format a date string he’s pulling out from a MySQL table. He’s just started learning PHP, so he’s still getting to grips with things. When he came to me with his problem, I sent him a link to the date function, but he couldn’t understand the manual’s [...]

09 Mar 2011 / 1 Comment / PHP Scripts, Tips & Tricks / by Maruf

JQuery – Hover And Show Next Element

So, this JQuery code shows the next element (a DIV in this case) when you hover over a “trigger” (in this case, the triggers are hyperlinks), and then hides the element (the DIV and its contents) once you hover out. Below is a demo of exactly what I mean… Demo Link- Gallery Take a look [...]

17 Feb 2011 / 0 Comments / jQuery Scripts & Helpful Snippets / by Maruf

CSS- Using Float With List Item Bullets in I.E 6/7

Note to self and everyone else having a breakdown over this issue, YOU CANNOT float a list in I.E 6 or 7 and have the bullets display. It took me way too long to realise that. I have searched high and low for a legitimate way of making it work (without using JavaScript), but apparently [...]

08 Dec 2010 / 3 Comments / CSS Tips & Tricks / by Maruf

Ajax- JQuery Hovering/Expanding Info Box

I looked high and low for an “AJAX hovering/expanding info box”, but I couldn’t really find anything decent that worked in all browsers. Most of them choked when using I.E. I may have even been Googling the wrong keyphrase, I’m not even sure I named this effect the right thing… For those of you who [...]

24 Nov 2010 / 3 Comments / jQuery Scripts & Helpful Snippets / by Maruf
Page 1 of 512345
© 2012 BrightCherry :)