LBPP Posted July 11, 2006 Share Posted July 11, 2006 I have a php script that shows a mini calendar on my site [url=http://www.LBPP.net/geeklog]http://www.LBPP.net/geeklog[/url], right now the days are abbreviated to 3 chars ie "Sun" because of this it is making the calendar too wide and is being cut off. I need to truncate the output of this script to just one char so its like "S" "M" "T" "W" "T" "F" "S". This is what i have:[code] // Main Calendar $BlockDisplay .= "</td></tr><tr>"; for ($i = 0; $i < 7; $i++) { $BlockDisplay .= "<td align='center' valign='top' width='14%' class='mycalTitle'><font size='1'><b>" . ucfirst(strftime("%a", $firstdaytodisplay + ($i * _MYCAL_DAY_))) . "</b></font></td>"; }[/code]I did not write this code and am only trying to modify it, but my PHP skills are limited. Any insight in the direction i need to take would be much appreciated. Link to comment https://forums.phpfreaks.com/topic/14317-truncate-string-to-one-char-for-small-calendar-display/ Share on other sites More sharing options...
LBPP Posted July 11, 2006 Author Share Posted July 11, 2006 i know this is easy... im just stupid, can no one give me a quick solution? Link to comment https://forums.phpfreaks.com/topic/14317-truncate-string-to-one-char-for-small-calendar-display/#findComment-56398 Share on other sites More sharing options...
ShogunWarrior Posted July 11, 2006 Share Posted July 11, 2006 ucfirst(strftime("%a", $firstdaytodisplay + ($i * _MYCAL_DAY_)))Replace with:[b]substr(ucfirst(strftime("%a", $firstdaytodisplay + ($i * _MYCAL_DAY_))),0,1)[/b] Link to comment https://forums.phpfreaks.com/topic/14317-truncate-string-to-one-char-for-small-calendar-display/#findComment-56410 Share on other sites More sharing options...
LBPP Posted July 11, 2006 Author Share Posted July 11, 2006 YAY!!! thanks ShogunWarrior!! Link to comment https://forums.phpfreaks.com/topic/14317-truncate-string-to-one-char-for-small-calendar-display/#findComment-56417 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.