Welcome To Snipplr
Everyone's Recent PHP Snippets
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
An example of how to write your own navigation with dynamic "active" classes.
3
1020
posted 15 years ago by kristarella
this will give you a lovely RSS.
Im sure you will need to edit the database stuff and row names
5
1113
posted 15 years ago by antpaw
A PHP function that correctly validates all parts of a given email address, according to RFCs 5322, 5321, 1123, 2396, 3696, 4291, 4343, 2821 & 2822. I’ve released it under a license that allows you to use it royalty-free in commercial or non-commer...
4
1288
posted 15 years ago by dominicsayers
Is.Gd is a URL-shortening service much like TinyURL. Using PHP’s cURL library, you can create shortened URLs on the fly with ease. “is.gd†is much shorter than “tinyurl.com†so if you need the URL to be as short as possible, use this method...
0
776
posted 15 years ago by nerdsane
If reading email from a POP box with PHP, you can use this to strip out signatures (ones that are delimited with the proper '--' notation). It will only strip the last signature of an email, in case someone enters a '--' intentionally elsewhere.
0
825
posted 15 years ago by DaveChild
I use this snippet to force a number to 2 decimal places.
Eg, For prices, PHP rounds the number 22.20 to 22.2. This code forces a zero on the end if there isn't 2 decimal places already.
1
872
posted 15 years ago by xtheonex
Function to return the current page name, without the location of it...
Eg, for the URL http://localhost/www/someproject/index.php, this would return index.php
1
721
posted 15 years ago by xtheonex
A quick, usefull function which i use to convert a date/time string pulled from MySQL, into a readable format.
1
880
posted 15 years ago by xtheonex
Use with (in custom.css) .sidebar_box {margin-bottom:2em; text-align:center;}
You may have to adjust the width for your sidebars.
2
926
posted 15 years ago by kristarella
The function content should work in any theme, it's just wrapped in a function wrapper for insertion into the Thesis theme.
2
923
posted 15 years ago by kristarella
This CSS is nice to use with this function:
.custom .avatar {float:left; border:3px solid #ddd; margin-right:1em;}
2
843
posted 15 years ago by kristarella
This shows how to add content (in this case a linked image) to the end of a post using WordPress custom fields and the Thesis theme.
6
955
posted 15 years ago by kristarella
So. You have some minutes and want a "human readable" version? Sure thing baby!
2
6298
posted 15 years ago by optimal
[quote]$_SERVER['HTTP_REFERRER']'s problem is that can be spoofed, but it's better than nothing if you really want that.[/quote]
1
1032
posted 15 years ago by luizlopes