Profile
Achievement
danielwrobert's Recent Snippets
- All /
« Prev 1 Next »
I saw this useful little variation of a for loop in a tutorial by Kevin Yank at Sitepoint. By adding an additional variable "ii" in the loop's arguments, you can avoid having your program calculate the length of your array every time it loops through...
1
765
posted 13 years ago by danielwrobert
Previously, I posted a little snippet I found on how to generate a special body class on each .php page. I, later, needed to get that body class and echo out a piece of HTML, which depended on my current page. So here is the snippet that I came up wi...
0
730
posted 13 years ago by danielwrobert
A very simple HTML redirect that I found useful for a contact form confirmation.
The number preceding the url (in this case zero) tells the browser the number of seconds to wait before redirecting to the new url. For example, you could set this to...
0
992
posted 13 years ago by danielwrobert
From an awesome comment on how you can use PHP to apply the unique ID to to the body element. This will return the name of the PHP file being executed as the ID (e.g. body id="index.php"). To leave off the .php part, just remove the ".php" part.
0
979
posted 13 years ago by danielwrobert
A nice little code snippet for displaying images randomly when a page is reloaded.
0
638
posted 13 years ago by danielwrobert