Jump to content

jimfog

Members
  • Posts

    1,803
  • Joined

  • Last visited

Everything posted by jimfog

  1. I just made a simple question and it sparked many responses-that is what I call "community".
  2. I wonder, if we want to use the methods/properties of a class. Is it necessary that we must first instantiate this class-meaning making an object out of it?
  3. jimfog

    date range

    NEVERMIND, IT WORKS, MANY THANKS TO YOU TWO, This logic is new to me and I might come back for questions-as part of the learning process though.
  4. jimfog

    date range

    I tried dsonesuk's code and the problem is that ALL the rows are highlighted and not just the one corresponding to the current week: $cmonth = date("m") ;$cYear = date("Y");$convert_datecount = new DateTime($datecount.'-'. $cmonth .'-'.$cYear );$convert_datecount = $convert_datecount->modify("tomorrow")->format('Ymd');$today=$now;$startDate = $today->modify("tomorrow")->modify("last Monday")->format('Ymd');$endDate = $today->modify("yesterday")->modify("next Sunday")->format('Ymd');for ($date = 1; $date < ($totaldays_in_mon + $startdate); $date++) { $colcout++; if ($colcout == 1) { if((isset($_GET['weekview']))&&($convert_datecount>= $startDate && $convert_datecount<= $endDate)) echo '<tr class="other" >'; else echo '<tr class="john" >'; } if ($date >= $startdate) { $datecount++; } if ($colcout == 6 || $colcout == 7) { $cellclass = "weekend"; } else { $cellclass = "weekdays"; } {echo "<td class=".$cellclass.'id=dateid_' . $year . str_pad(date('m', $month), 2, '0', STR_PAD_LEFT) . str_pad($datecount, 2, '0', STR_PAD_LEFT).'>'.$datecount."</td>";} if ($colcout % 7 == 0) { $colcout = 0; $rowcount++; } Here is the link so you can see https://skydrive.live.com/redir.aspx?cid=be27434b2aac8130&resid=BE27434B2AAC8130!234&parid=BE27434B2AAC8130!140 I will have to use a different strategy but dsonesuk can tell better if I did sth wrong in the code above and it does not work as expected
  5. so stating the question somehow different-usually, in a modern site, functions performed by php are now performed by Ajax.is the above statement correct? is there any function left performed solely by php?
  6. What functions of a site usually use AJAX and which not?
  7. jimfog

    math forum

    Calculus for example
  8. Are the most modern sites of today fully AJAX? I mean, is there anything left(a link maybe) to be done with a conventional(non-AJAX) way?
  9. jimfog

    date range

    I think I got your point about "meaningless strings". My assumption was that $today=$now->format('j m Y'); will suffice cause $now( which is a date object) is assigned to $today and that is that. I did not know that the above was wrong.Furthermore I assume, now, that the below code is correct: $startDate = $today->modify("tomorrow")->modify("last Monday")->format('Ymd');$endDate = $today->modify("yesterday")->modify("next Sunday")->format('Ymd'); ...because $today contains a date object. Am I saying it correctly?
  10. jimfog

    date range

    Do you believe the above code is better than that you have given me the other days? I am assuming the reason you changed it is for including the week highlighting feature I need. Correct?
  11. jimfog

    date range

    give me a little help please,what are you trying to do here? Are you demonstrating a new code for looping the days of a month, different from the one you have given me the other days? Or is it sth else-just an answer to what the previous post was claiming? And if you are looping where is the for loop?
  12. jimfog

    date range

    Where exactly is the mistake in the code above? Just give me an example-in theory I understand what are you talking about. Are you referring to the $datecount variable?
  13. Can you elaborate a little please? Give an example-it would be best.
  14. In the web app I am building the design pattern I am using is the following. For example, the app/website has 3 pages, and in these 3 pages functions are called, the functions are located in a separate output.php file. Is the above an example of a "template system"?If not give me an example of a template system please.
  15. jimfog

    math forum

    Are you aware of any good math forum in the web-computing has a lot of math in it so I want to sharpen my skills a little.
  16. Never mind, I found the solution to my problem.
  17. Suppose that we have an if statement that does not work-,it is a logic error-, does such a statement outputs false? Not in the browser I mean as en echo statement.
  18. jimfog

    date range

    Why that, i am confused,can you elaborate please a little I am confused here too, maybe if you write some code i will be able to understand it better. Either way there still is a problem when highlighting the days which refer to the days that belong to previous/next month. Formatting does not take place there, see image:https://skydrive.live.com/redir.aspx?cid=be27434b2aac8130&resid=BE27434B2AAC8130!233&parid=BE27434B2AAC8130!140
  19. jimfog

    date range

    Ι've managed to pull it off-partially. Instead of targeting the tr element I targeted the td element(which contains the number corresponding to the day of the month) and instead of using $today i used $datecount which is the variable the prints the days of the month. Look at the image and the code: https://skydrive.live.com/redir.aspx?cid=be27434b2aac8130&resid=BE27434B2AAC8130!232&parid=BE27434B2AAC8130!140 if($datecount>= $startDate && $datecount <= $endDate) if((date("d") == $datecount)&& (date("n") == (date("n", strtotime($newdate))))) { echo "<td class='current-day-highlited' align='center' valign='middle' height='20px'>" .$datecount. "</td>\n";} else {echo "<td class='other' align='center' valign='middle' height='20px'>".$datecount."</td>\n";} The inner if statement just highlights the current day within the current week.
  20. jimfog

    date range

    Then I should say better "HTML", i am putting it in quotes-since as you said PHP generates the HTML here.
  21. jimfog

    date range

    Ok now it works,thanks for that but the problem is that all the rows of the calendar gets id="current_week", now we are talking abouthtml problem and not PHP, php works. The code is the one you gave me here http://w3schools.invisionzone.com/index.php?showtopic=42239&hl=&fromsearch=1The only change i made is to make tr class change when the user on the day or month, about week, we are still trying-but i think we are closeIn short here it is: if ($colcout == 1) { if(isset($_GET['month'])) {echo '<tr class="monthgreen" >';} elseif (isset($_GET['weekview'])) { if($today>= $startDate && $today <= $endDate) {echo '<tr id="current_week" >';} else {echo '<tr class="jn">';} } else echo '<tr class="john">'; } The problem is depicted in this picture here, which is taken from firebug:https://skydrive.live.com/redir.aspx?cid=be27434b2aac8130&resid=BE27434B2AAC8130!231&parid=BE27434B2AAC8130!140 Thanks again
  22. jimfog

    date range

    You are correct. So, I am having a logic error. I have a lead and i will follow it-see where i will get.
  23. jimfog

    date range

    I use your code and something is wrong-the tr element is not highlighted as expected,i think your code is OK, probably my syntax is somewhere wrong,Look at the code-it is short: $now = new DateTime($newdate);$today=$now->format('j m Y');$startDate = $mondayweek->modify("tomorrow")->modify("last Monday")->format('j m Y');$endDate = $mondayweek->modify("yesterday")->modify("next Sunday")->format('j m Y');if(isset($_GET['month'])) {echo '<tr class="monthgreen" >';} elseif (isset($_GET['weekview'])) { if($today>= $startDate && $today <= $endDate) {echo '<tr id="current_week" >';} else {echo '<tr class="john">';} } else echo '<tr class="john">'; Instead of $current I used $now, it is better for me, for clarity reason. That is one thing.The other is the echo statements above where i got to implement the conditional you gave me. Do not be distracted from "monthgreen", this is for when the users are seeing the month-this is OK. What do you think? If there is a syntax error i cannot find it.
  24. jimfog

    date range

    Yes,that approach seems better,instead of looping through dates.There is one code segment i do not understand though. $startDate = $monday->modify("tomorrow")->modify("last Monday")->format('Ymd');$endDate = $sunday->modify("yesterday")->modify("next Sunday")->format('Ymd'); Why you want to use 2 modify methods,the one next to each other?Why not for example not use modify->(this monday), modify->(this sunday)? I miss something here.
  25. jimfog

    date range

    What do you mean? Can you be more specific please?
×
×
  • Create New...