Posted By

discipolo on 02/23/11


Tagged

templatephp widows


Versions (?)

Solving the widow problem on your Drupal website Titles


 / Published in: PHP
 

URL: http://club-sandru.ro/blog/solving_the_widow_problem_on_your_drupal_website.html

Anywhere, the variable $title is printed in a template file, it can be wrapped in this function:

YOURTHEME_widont($title)

  1. function YOURTHEME_widont($str = '') {
  2. $str = rtrim($str);
  3. $space = strrpos($str, ' ');
  4. if ($space !== false) {
  5. $str = substr($str, 0, $space).' '.substr($str, $space + 1);
  6. }
  7. return $str;
  8. }

Report this snippet  

You need to login to post a comment.