How to change the starting day of this week's calendar?
im trying to implement a calendar in my website, im using code from: http://www.yiiframework.com/forum/index.php?/topic/3889-free-form-calendar-application/ The ma开发者_运维问答in code is in the second post. But the thing is that the week starts on sunday and i need to change it to monday and i can't figure out how to do that. A little help is needed!:)
I haven't used that class before, but reading the source code I see this line:
/* table headings */
$headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
initializing the variable headings
whose contents are not modified in the whole program, and they are simply printed to the HTML string (variable calendar
) with an implode
.
This class also lacks a parameter for the constructor to tell it that the user needs the output with Monday (or any other day) as the first day of the week...
If you want to modify this class in order to implement that functionality, you should do:
- For the heading cells: make your changes around the line where the
implode
over theheadings
variable is done. - For the remaining cells: analyze carefully the variable
running_day
. - Also do not forget that it is nice to have this behaviour set by a variable given as parameter to the constructor of the class.
精彩评论