SearchRecent posts
The Random ToolboxDrupal 7 Setting up variables for use in a template (preprocess and process functions) Rendering Drupal 7 fields (the right way) Linux Secure Copy (scp) command Restrict Free Shipping in Magento Quickbooks Text Connection Ticket Cross-Site Request Forgery (CSRF) jQuery Events: MouseOver / MouseOut vs. MouseEnter / MouseLeave Monthly archive
|
Trim Text to a Certain Length on a Word Boundary in PHP$caption = $your_starting_text; if (strlen( $caption ) > 230) { print preg_replace('/\s+?(\S+)?$/', '', substr( $caption , 0, 230)) . '...'; } else { print $caption ; } |