I follow the php book trying to create a calendar. The problem is that whenever I follow the code, I snags.
Here is a loop from the book
for ($ i = 1, $ c = 1, $ t = date ('j'), $ m = date ('M'), $ y = date ('y'); $ c & lt; = $ this- & gt; _daysInMonth; ++ $ i) Does the site of books, but not in my code I do not understand how this can happen, but endless loop.
Edit Here's the whole function, now it works, but I still do not understand how ...
$ html = "\ N \ t "; // ny liste ($ i = 1, $ c = 1, $ t = date '' '', $ m = date ('m'), $ y = date ('y'); $ c & Lt; = $ this-> _daysInMonth; ++ $ i) Endless loop leg til ++ $ c {/ * * Apply a "fill" class * / $ class = $ i < = $ This- & gt; _startDay? "Fill": zero; / * * Add to today's date * / if ($ c == $ t & $ m == $ this- & gt; _m & amp; $ y == $ this- & gt; _Y) {$ square = "Today"; } / * * Create an opening and ending list for item tags * / $ ls = sprintf ("\ n \ t \ t & li; li class = \"% s \ "& gt;" $ class); $ Le = "\ n \ t \ t & lt; / li & gt;"; / * * Add days of the month to identify the calendar box / if ($ -> this- & gt; get started & lt; $ i & amp; $ this- & gt; _daysInMonth & gt; = $ c ) {$ Date = sprintf ("\ N \ t \ t \ t % 02d ", $ c ++); } And {$ date = "& amp; nsbp;"; } / * * If wrap the current date saturday next line * / $ wrap = $ i! = 0 & amp; Amp; $ I% 7 == 0? "\ N \ t \ n \ t ul & gt;" : Zero; $ Html $ $ Ls $ date $ $ $ Wrap; }
$ c This line increases:
$ Date = sprintf ("\ n \ t \ t \ t & lt; strong & gt;% 02d & lt; / strong & gt;", $ c ++);
Comments
Post a Comment