Guest james_starkie Posted April 13, 2006 Share Posted April 13, 2006 But it's not quite that simple, I only want the ellipsis to be removed when the product description is blank. So it looks like this: It's a minor detail, but I've been asked by a client if it's possible to do. I imagine it is, using an if statement, but my php knowledge isn't up to that standard. Any help is appreciated. (using latest version of CC btw.) Quote Link to comment Share on other sites More sharing options...
Guest Posted April 13, 2006 Share Posted April 13, 2006 Ok, this fix is off the top of my head and has not been tested, but it should work. In /includes/content/viewCat.inc.php find this line: $view_cat->assign("TXT_DESC",substr(strip_tags($productResults[$i]['description']),0,$config['productPrecis'])."…"); Replace that line with these lines: $tmpdesc = substr(strip_tags($productResults[$i]['description']),0,$config['productPrecis'])."…"); if($tmpdesc == "..." ) { $view_cat->assign("TXT_DESC",""); } else { $view_cat->assign("TXT_DESC",$tmpdesc); } :w00t: Quote Link to comment Share on other sites More sharing options...
Guest xpc Posted April 13, 2006 Share Posted April 13, 2006 Ok, this fix is off the top of my head and has not been tested, but it should work. In /includes/content/viewCat.inc.php find this line: $view_cat->assign("TXT_DESC",substr(strip_tags($productResults[$i]['description']),0,$config['productPrecis'])."…"); Replace that line with these lines: $tmpdesc = substr(strip_tags($productResults[$i]['description']),0,$config['productPrecis'])."…"); if($tmpdesc == "..." ) { $view_cat->assign("TXT_DESC",""); } else { $view_cat->assign("TXT_DESC",$tmpdesc); } Nice Sir William, the "..." were buging me to. But there is an small error in this line: $tmpdesc = substr(strip_tags($productResults[$i]['description']),0,$config['productPrecis'])."…"); the correct its this: $tmpdesc = substr(strip_tags($productResults[$i]['description']),0,$config['productPrecis']."…"); Quote Link to comment Share on other sites More sharing options...
convict Posted April 13, 2006 Share Posted April 13, 2006 I think the correct is following: $tmpdesc = substr(strip_tags($productResults[$i]['description']),0,$config['productPrecis'])."…"; OR just another condition $tmpdesc = substr(strip_tags($productResults[$i]['description']),0,$config['productPrecis']); if(empty($tmpdesc)) { $view_cat->assign("TXT_DESC",""); } else { $view_cat->assign("TXT_DESC",$tmpdesc."…"); } SW made just programmer's typo, useless copied end parenthesis :w00t: Quote Link to comment Share on other sites More sharing options...
Guest james_starkie Posted April 13, 2006 Share Posted April 13, 2006 Yep, that works convict. Thanks for the help guys :D Quote Link to comment Share on other sites More sharing options...
Guest meezyart Posted October 30, 2008 Share Posted October 30, 2008 you guys are really helpful. how about removing the ellipsis all together? Still keeping the description ofcourse. 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.