MaggsWeb:7

www.maggsweb.com

Posts Tagged ‘ PHP ’

This has got to be the most self-explanatory, most obvious, but coolest function ever!
[More]

I usually write my own vars out to the screen for debugging using ‘print_r($_SESSION)’,'print_r($_POST)’etc inside <pre> tags, but this is awesome! (a little too much even). It’s like phpinfo(), but for your webpage!
[More]

How do you style a search button?  They all look crap to me, and the default browser ones are all different.  So, my solution is to get rid of it.  Gone.  No button.    Heres how…

[More]

Where am I…

September 26, 2008 | Comments | PHP

string basename ( string $path [, string $suffix ] )

  1. PATH :: A path. On Windows, both slash (/) and backslash (\) are used as directory separator character. In other environments, it is the forward slash (/).
    suffix.
  2. SUFFIX :: If the filename ends in suffix this will also be cut off.

I use this a lot to distinguish which page I am on. Generally, I would match this to a db record to get page-specific info and settings from the database.
[More]

I have been looking for a ‘simple’ tag cloud generator that will parse content from MySQL for ages and couldn’t find one. So I adapted – and heavily modified (reduced) – and CSS’d – the best one that I could find. It turned out nice and simple.
[More]

PHP Image UpLoader

October 18, 2007 | Comments | PHP

My image upload script. Loads of checks, not all used each time. Optional file-physical-size checks rely on ‘getimagesize’ working. Its long, but stick with it. It works.
[More]

Simple captcha

October 4, 2007 | Comments | PHP

Spam! Urrrgggh! Want a ‘simple’ way of stopping spam in form submissions? Have a go at this, written by myself and used on quite a number of sites. Its simple – and works without relying on third-party-providers.
[More]

Logging user activity

August 22, 2007 | Comments | PHP

Logging user activity is vital when there are multiple authors for a site. It also helps with debugging user activity when there is problems. You certainly don’t want to be putting this into a database, so the next best thing is a nice little text file.
I have used this to log user activity in a number of sites, as it can easily be added after development. In this example, $PAGE and $pageTitle are set in each page as they are used to determine menu selections, etc.. but these can easily be set manually.
[More]

trimtext with display

July 23, 2007 | Comments | PHP

Text too long…? Not wrapping, or pushing other elements around…? I wrote this little function to trim text to any length, adding ‘…’ at the end if trimmed. Then, it displays the full text as you hover over it. Cooool!

[More]

imageResize (inline)

May 23, 2007 | Comments | PHP

Can’t rely on the size of an uploaded image and don’t want to resize it?

This function takes the larger size of the width and height and applies a formula accordingly. Then gets the new value and applies the percentage, then rounds the value. It returns the new sizes in html image tag format so that you can plug this function inside an image tag.

[More]