Browsing articles in "Server Side Code"
Jun
25
2011

PHP if statement with multiple not equal conditions

I like to think of this one as AND OR confusion. This is based on actual code found within Sugar CRM so if it threw you for a loop your not alone. I have reported the bug to them, however as of 6/25/2011 it still has not been addressed. Now lets make sure we do not fall victim to this. Ok this is a simple one however I cannot tell you how many times this […]

Jun
23
2011

PHP Create Awesome Slugs

This is the function I use when creating slugs with PHP. It accepts a string and removes any special characters other than – and _ It will than replace spaces with dashes, underscores with dashes and double dashes with a single dash and finally returns makes the entire string lower case. Example use: This function will make SEF (search engine friendly) URL creation a snap!

Jun
23
2011

PHP Get URI Segment(s)

Here is a set of two php functions that I use regularly to quickly get a specific URI segment or return all segments available. These are very helpful if you have written or are writing your own custom SEF urls How to use: Happy Coding!

Jun
1
2011

Convert RSS pubDate to MySQL Datetime

Today in creating an application to parse through many RSS feeds I needed a quick function to convert RSS publish date to a valid MYSQL datetime string. A quick Google search revealed 2 things: There was not a copy and paste function readily available There were many unanswered posts asking for such a function So I thought I would take a few minutes out of my afternoon to put together a quick solution. The code: […]

May
23
2011

PHP function to remove MS Word Characters

There has been many times I have implemented WYSIWYG editors on my clients website only to have proprietary MS tags and code ruin the layout. I have been using this block of code for quite some time with pretty good success. It could use a bit more testing and I am sure there are additional characters or regular expression rules that could really button it up. If you find a way to improve upon this […]

May
22
2011

Truncating read more text by words not length

I have found that truncating a string by it length is not always an elegant solution. To give your site a more polished look try truncating by whole words instead. So instead of getting something like: “This is my awesome paragraph. It is really long and I am making it shor… read more” You will get: “This is my awesome paragraph. It is really long and I am making it shorter… read more”

Show/Hide Footer Actions

Status: Available for your project.