![]() |
An Efficient Calendar Generation
I would like to know if this is a good way to generate a calendar for the given month? If there's anything I can do to dramatically increase the page generation time, or even optimize the HTML?
I'm here to readily learn. :) Demo : http://saney.ath.cx:8080/nutricraze.php Code (without stylesheet or javascript *See Demo*): :
<?php |
Well, this is gonna be in pseudo code but I'll try and stick to the variables that you put up.
:
month_start = ((7 - day % 7) + day_of_week + 1) % 7 |
Well here we go, I reworked it in PHP, with blank entries and the like. I didn't quite understand your formatting for the days of the month and the current day so I leave that up to you. I also stuck to the variables that you used in your code though I sorta used $my_time as a temporary variable.
:
<? |
Ahh, I see. That's definitely the other approach to it. While I was doing it all in one while loop, you break it up since we assume everything will be in a constant form (ABA, persay).
Depending on how quickly PHP handles loops, mine might be faster. But yours probably is. I'll run some tests later on both, and see if I can optimize your method a bit (if it's better). |
| All times are GMT -5. The time now is 1:14 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC