Web Design Blog

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

SMF- Show Page Number In Thread Title

My God, I’ve only just recently started playing around with SM Forums, and I can honestly say the documentation is God awful. At least, it’s terrible compared to WordPress. Also, it’s not coded that great- even applying the simpliest of features require plugins (“mods”, as the SMF community call them) and/or hacks. Anyways, in this [...]

16 Sep 2009 / 0 Comments / SMF- Simple Machines Forum / by Maruf

PHP- Check If A Number Is Multiple Of Another Number

This is one of those posts that is purely a reminder for myself. It’s something so simple, but for some reason or another, I tend to forget. Suppose I have a loop, and I want to call a certain action on every 5th loop. For example, on the 5th, 10th, 15th..etc count, I want to [...]

13 Sep 2009 / 0 Comments / PHP Scripts, Tips & Tricks / by Maruf

WordPress- Display Google Adsense After 1st Paragraph Tag

I’ve been playing around with Google Adsense a lot lately- in particular trying to find out where the ads are best placed on a WordPress Blog to maximise click through rates (CTR). I’ve been looking at some wordpress plugins, but I couldn’t find any that allowed me to display an ad unit after the first [...]

23 Aug 2009 / 9 Comments / Wordpress / by Maruf

Htaccess: Prevent People Hotlinking Your Images

Here’s some Htaccess code that will prevent people from hotlinking images hosted on your server. Simply change the domain to yours and then apply the code to your .htaccess. It’s as easy as that. 1 2 3 RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http(s)?://(.*\.)?brightcherry.co.uk [NC] RewriteRule \.(jpeg|jpg|gif|png)$ – [F] The code is basically saying that all [...]

22 Aug 2009 / 1 Comment / htaccess fun / by Maruf

MySQL- Counting The Total Occurances Of A Regular Expression In A Table Column

Ok, so here’s the scenerio- you have a table like this in your DB: The question is: How do you count how many images there are in the images column for the entire table? From what I’m aware, you can’t do it with a standard MySQL function. So the solution? You have to create your [...]

16 Jul 2009 / 0 Comments / MySQL Functions, Tips & Tricks / by Maruf

WordPress: Displaying Parent Categories Only & Putting Categories Into A Foreach Loop

I’ve been working with manipulating WordPress Categories a lot recently, so I’m just going to quickly jot down a few notes, as I’m sure I’ll need these in the future. From what i’m aware, currently, WordPress doesn’t allow enough flexibility when it comes to manipulating categories, especially when it comes to identifying the difference between [...]

30 Jun 2009 / 6 Comments / Wordpress / by Maruf

PHP- Getting The Filename From A URL

Someone emailed me, asking me how to get the filename from a URL using PHP. It’s pretty easy, but I thought i’d jot it down for everyone, just in case other people want the same result. Example Ok, so we want the filename for the following page: http://www.anydomain.co.uk/page/grab.php We want to grab the filename, which [...]

27 Mar 2009 / 6 Comments / PHP Scripts, Tips & Tricks / by Maruf

JQuery- Auto Refresh Div Every X Seconds

I’ve recently been working on a e-commerce site (online store) for a client. One of the features required was to show the most recently viewed items on the homepage. For that to work, I need to write a script to query a DB every 10secs or so. Youtube actually has something similar, where on the [...]

26 Feb 2009 / 113 Comments / jQuery Scripts & Helpful Snippets / by Maruf

Remove Redundant CSS From Your Stylesheet

Last week someone approached me with a problem- their website was running significantly slow. There were many obvious problems, but the issue I’m going to cover today is CSS stylesheets. Believe it or not, but stylesheets can slowdown a website if they get too bloated. It’s extremely common for a web developer to fill stylesheets [...]

14 Jan 2009 / 2 Comments / CSS Tips & Tricks / by Maruf

PHP- Adding And Subtracting Dates

Here’s how you add and subtract dates from one another. For example, this simple code can calculate what the date will be 2 weeks before or after 1998-08-14 (yyyy-mm-dd). Subtracting days from a date The following example will subtract 3 days from 1998-08-14. The result will be 1998-08-11. 1 2 3 4 5 $date = [...]

06 Jan 2009 / 34 Comments / PHP Scripts, Tips & Tricks / by Maruf

Ajax Jquery Contact Form With Validation

I’ve put together a simple AJAX contact form, using the Jquery library (my personal favourite). What does this all mean? Well, it’s basically a contact form which validates and submits an email without the page refreshing. You can see an example on our contact page. The example i’m providing for download is extremely simple. If [...]

11 Dec 2008 / 18 Comments / jQuery Scripts & Helpful Snippets / by Maruf

HTML Form Effect- Remove Default Value On Focus

This Javascript form effect basically removes the default value (e.g Your Name) when the input field is on focus. If nothing is entered, and focus is taken away from the input field, the value is displayed again. It’s a pretty cool effect, which I’m always using on a lot of projects. Here’s an example (click [...]

04 Dec 2008 / 10 Comments / Javascript / by Maruf

We Only Provide WordPress Support With A Condition

BrightCherry have glady released multiple Free WordPress Themes, and happily provided support to anyone who has required it. We like building the themes; we enjoy watching people use them, and we enjoy helping people get to grips with WordPress. However, we’ve noticed that a lot of our theme users have been discrediting our work by [...]

01 Dec 2008 / 0 Comments / Free Wordpress Themes / by Maruf

PHP- Check If File Exists On Different Domain

Earlier today I needed to find out if a file exists on a different domain. Initially I used the file_exists function, but then when that threw back an error I remembered that file_exists only checks whether a file or directory exists on the same server as the script. After I played around with various functions, [...]

20 Nov 2008 / 11 Comments / PHP Scripts, Tips & Tricks / by Maruf

MySQL & PHP- Show Tables In Database

Someone asked me the other day how to display the existing tables in their database with a PHP script. The query itself is pretty simple, but people seem to get confused about the PHP side of it. Then again, once you look at the code, you might be surprised how easy it really is… Printing [...]

14 Nov 2008 / 5 Comments / MySQL & PHP / by Maruf
Page 3 of 512345
© 2012 BrightCherry :)