robb3369 Posted April 21, 2010 Share Posted April 21, 2010 After trying to keep three columns of knowledgebase categories looking good and somewhat aligned with their rather short titles and descriptions, I came across a nice smarty plugin to do just that. Its based on the wordpress plugin called widont. It basically prevents a sentence from wrapping and only having one word on the second line, so rather than you having to rewrite the sentence to look better, this modifier takes care of it. Save this in your WHMCS/includes/smarty/plugins as modifier.widont.php: <?php /** * Smarty plugin * @package Smarty * @subpackage plugins * * Type: modifier<br> * Name: widont<br> * Purpose: add an between the last two words of a paragraph to prevent orphan words (widows) * based on Shaun Inman's Widon't wordpress plugin * @author J Cornelius <smarty at jcornelius dot com> * @param string $string the string to manipulate * @return string the string with an added */ function smarty_modifier_widont($string = '') { return preg_replace('|([^\s])\s+([^\s]+)\s*$|', '$1 $2', $string); } ?> And you can you it (for example) in the knowledgebase.tpl and knowledgebasecat.tpl files. Just change the occurrence of {$kbcat.description} to {$kbcat.description|widont} 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted April 22, 2010 Share Posted April 22, 2010 Any Screenies?? 0 Quote Link to comment Share on other sites More sharing options...
robb3369 Posted April 24, 2010 Author Share Posted April 24, 2010 Here is a link to the original WP plugin with a nice visual: http://shauninman.com/archive/2006/08/22/widont_wordpress_plugin 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.