Welcome To Snipplr
Everyone's Recent PHP Snippets
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
This function will add soft hyphens after every 3rd character in words of over 10 characters. It will not leave fewer than three characters following a soft hyphen.
Known bugs: Adds soft hyphens to URLs and within HTML tags.
0
912
posted 15 years ago by DaveChild
If `views_embed_view()` or just `$view->execute()` are called, the default view settings are used (only shows 10 entries, etc.) so we have to call `$view->set_display()` & `$view->pre_execute()`.
0
747
posted 15 years ago by jonathanpglick
Code explains itself. I plan to do a lot more work on it - just wanted to throw it up here for a little sharing. Feel free to take it to the next level.
1
933
posted 15 years ago by brettbergeron
Ever wanted to give your cliant an idear on how much disk space they have remaining? The following script will tell your user how much disk space has been used and how much is remaining. In this example $diskspace refers the amount of diskspace you...
1
1040
posted 15 years ago by scopefragger
This code allows you to retrieve the 11-character ID string from a YouTube video URL.
7
3010
posted 15 years ago by Moridin
Create a block to include a template file .phtml with just one line of code
1
1998
posted 15 years ago by nico65
Ever needed to convert rgb to hex on your website, maybe you have a slider that handles rgb but your backend uses hex, this issue can be resolved easily be using the following code. Remember to keep in mind that php and html primarily uses hex colo...
1
1091
posted 15 years ago by scopefragger
Display the number of people following you on Twitter using this custom Twitter badge. The code simply returns a number so you can style it however you like.
1
1137
posted 15 years ago by neal_grosskopf
Ever needed to get the page your user is currently viewing? This can be done quickly in php all thanks to $_server.
3
1005
posted 15 years ago by scopefragger
Useful for controllers. Put this in your base class for easy caching on variable (GET, POST) dependent pages
0
929
posted 15 years ago by iloveitaly
Sometimes you just need to mask a script or reject a user from a page this can be done effortlessly using a single line of code. Header location will allow you to redirect a user quickly and without them having any control over the action.
A good...
1
976
posted 15 years ago by scopefragger
calendar module's mini calendar includes a needles 'empty day' div in every date cell. this kills them.
0
1000
posted 15 years ago by canarymason
Easy check (:
**UPD**
You can just use [version_compare()](http://ca.php.net/manual/en/function.version-compare.php) function.
1
1056
posted 15 years ago by kirik
For use in conjunction with the get_work function in the theme functions template, functions.php.
0
858
posted 15 years ago by tylersticka
For use within The Loop, in your portfolio item page template.
0
934
posted 15 years ago by tylersticka
This is the Aidan Lister PHP countdown, translated for use in Norway.
No more 133 days untill christmas, but insted 3 months and 3 weeks.
0
1214
posted 15 years ago by stavelin
This is just a simple function to get the variable without having to worry if its POST or GET, and even allows for a default value to be passed in case the variable was not found.
0
958
posted 15 years ago by mondomondomxcom