samona Posted July 9, 2008 Share Posted July 9, 2008 Hi all, I have a problem. I'm trying to display output in red if it meets a certain criteria, however I can't seem to do so. I've figured out that you cannot use php code in the .tpl files. I want to do something like this: if ($num_students > 0){ $template->setVariable("STUDENTS",$num_students); } else { I want the variable $num_students to print in red font.} How can I do this? Is it even possible? Please Advise. Link to comment https://forums.phpfreaks.com/topic/113912-solved-help-in-templates-itx-template-class/ Share on other sites More sharing options...
rajivgonsalves Posted July 9, 2008 Share Posted July 9, 2008 your code should be $template->setVariable("STUDENTS",($num_students > 0) ? $num_students : "<font color='#FF0000'>{$num_students}</font>"); Link to comment https://forums.phpfreaks.com/topic/113912-solved-help-in-templates-itx-template-class/#findComment-585341 Share on other sites More sharing options...
samona Posted July 9, 2008 Author Share Posted July 9, 2008 thank you!!!!!!!!!!! Link to comment https://forums.phpfreaks.com/topic/113912-solved-help-in-templates-itx-template-class/#findComment-585359 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.