Jump to content

jimfog

Members
  • Posts

    1,803
  • Joined

  • Last visited

Everything posted by jimfog

  1. 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.
  2. 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.
  3. jimfog

    array suntax...

    Yes it must be a multidimensional array.
  4. jimfog

    date range

    What do you mean? Can you be more specific please?
  5. jimfog

    date range

    Yes you right to say that but i have already taken that into consideration. Look below and tell me what you think:$now = new DateTime($newdate);$week = $now->format('l') === 'Sunday' ? 'previous' : 'this';$monday = clone $now;$monday->modify('Monday ' . $week . ' week');$now->format('j');$sunday1=clone $now;$sunday1->modify('+7 days');$sunday = clone $now;$sunday->modify('Sunday ' . $week . ' week'); SO, with the above code i make sure that "monday" DOES refer to monday and not "now", meaning today's date.
  6. jimfog

    date range

    At last, now it works,thanks. :happy0046:Now i want to see sth in Dsonesuk's code.
  7. jimfog

    date range

    It does not work, i get the same message:Catchable fatal error: Object of class DateTime could not be converted to string in C:\xampp\htdocs\korakeiko\timetest3.php on line 14 Here is the whole code: $now = new DateTime;$week = $now->format('d-m-y') === 'Sunday' ? 'previous' : 'this';$monday = clone $now;$monday->modify('Monday ' . $week . ' week'); $sunday = clone $now;$sunday->modify('Sunday ' . $week . ' week'); I cannot understand why $day->modify('+1 day')) cannot be converted to a string.
  8. jimfog

    date range

    Regarding your code Dsonesuk i will see it later-i want to see first boen_robot's code(for educational purposes.) I tried the above code and the browser outputs that there is syntax error: Parse error: syntax error, unexpected ')' in C:\xampp\htdocs\korakeiko\timetest3.php on line I then tried for ($day = clone $monday; $current < $sunday; $day->modify('+1 day')) and i got the message that Catchable fatal error: Object of class DateTime could not be converted to string in C:\xampp\htdocs\korakeiko\timetest3.php on line Finally i tried for ($day = clone $monday->format('d-m-y'); $current < $sunday->format('d-m-y') ; $day->modify('+1 day')) abd then i got Fatal error: __clone method called on non-object in C:\xampp\htdocs\korakeiko\timetest3.php on line 16 There must be a problem with the object definition,i tried some things but i would appreciate some help.
  9. jimfog

    date range

    I want to take the dated between 2 dates that lie far left and far right of a specific date interval. For example i want to dates between 4-30-2012 and 5-5-2012. I found in the web the following code which works: $startDate = '4-30-2012';$endDate ='5-5-2012';for($current = $startDate ; $current != $endDate ; $current = date('d-m-Y', strtotime("$current +1 day"))) {echo $current.'<br>'; The problem is that i cannot do the above code work if instead of using date strings i use methods of the datelclass such as $monday->format('Y m d') or $sunday->format('Y m d') which both output date strings, Basically here is what i was trying to achieve: $startDate = [b]$monday->format('Y m d') [/b];$endDate = $[b]sunday->format('Y m d') [/b]';for($current = $startDate ; $current != $endDate ; $current = date('d-m-Y', strtotime("$current +1 day"))) {echo $current.'<br>'; What do you think? How am i going to take the date range between $monday->format('Y m d') and $sunday->format('Y m d') ? I think, that he above code does not work because strtotime cannot be used with methods such as these of the dateclass shown here.
  10. before proceeding and seeing as a whole this issue(of week highlighting) it is crucial i solve another problem(smaller one)that will help solving the highlighting one. For this smaller problem i am going to make another post-do not want mess things up.And then i will return again here.
  11. I want to highlight the week as outlook does https://skydrive.live.com/redir.aspx?cid=be27434b2aac8130&resid=BE27434B2AAC8130!230&parid=BE27434B2AAC8130!140&authkey=!APJhbiKPcxzm1z8 Look in the picture, and i know that continue is the causes the problem in the loop. I will see what am I going to do
  12. jimfog

    what debugger

    oh...but since we are 1 day away from the production version then i will wait till tomorrow and hopefully the problem will be solved
  13. jimfog

    what debugger

    Since the dll(i can neither find php5apache2_3.dll) was not found i will have to wait for the final version in 2 days. And to be precise that we are talking about the same thing, here is the name of the file i downloaded: php-5.4.1RC2.tar.
  14. jimfog

    what debugger

    Are you sure it will come out in 2 days? I followed option 1 but there was not any php5apache2_4.dll in the php folder?
  15. jimfog

    what debugger

    The problem continues.Apache does not restart. A window appears telling "Requested operation has failed"I tried to start Apache from the command prompt and here is the message that i got C:\Apache24\bin>httpd.exehttpd.exe: Syntax error on line 1 of C:/Apache24/conf/httpd.conf: Cannot load C:/php/php5apache2_2.dll into server: \xc4\xe5\xed \xde\xf4\xe1\xed \xe4\xf5\xed\xe1\xf4\xfc \xed\xe1 \xe5\xed\xf4\xef\xf0\xe9\xf3\xf4\xe5\xdf \xe7 \xea\xe1\xe8\xef\xf1\xe9\xf3\xec\xdd\xed\xe7 \xe4\xe9\xe1\xe4\xe9\xea\xe1\xf3\xdf\xe1. C:\Apache24\bin> Here is line 1LoadModule php5_module "C:\php\php5apache2_2.dll" Do you see any syntax error in the above line? The whole code of course that goes to apache config is the: LoadModule php5_module "C:\php\php5apache2_2.dll"AddType application\x-httpd-php.phpPHPIniDir "C:\php" I even tried changing the slashes from back ones to forward ones but without any result.
  16. jimfog

    what debugger

    I am in the proccess of installing separately pache,php and mysql. I downloaded apache from here http://www.apachelounge.com/download/win64/and php from here http://windows.php.net/download/ as boen robot suggested I am reading this tutorial here:http://www.ricocheting.com/how-to-install-on-windows/php I installed apache successfully but i cannot install php. The problem arises when following step 5(in "installing PHP")-after i do thatApache will not restart-i have downloaded php thread safe, so this is the correct version.
  17. It probably this is the problem-continue is required though(for another reason) to break the loop.
  18. Below you will find the code for this calendar https://skydrive.live.com/redir.aspx?cid=be27434b2aac8130&resid=BE27434B2AAC8130!229&parid=BE27434B2AAC8130!140 function leftside_cal_alt($startmonth, $endmonth, $startyear) { global $cYear, $cMonth, $monthNames, $newdate,$days,$prevMonth, $nextMonth,$monday,$k,$monday,$sunday; $cmonth=date("m"); $cYear=date("Y"); $currentyear = ""; $currentmonth = ""; $currentday = ""; for ($year = $startyear; $year < $startyear + 1; $year++) { for ($mon = $startmonth; $mon <= $endmonth; $mon++) { if ($mon != $currentmonth) { $month = mktime(0, 0, 0, $mon, 1, $year); if ($year != $currentyear) { ?> <table border="0"><?php echo'<a href="'.$_SERVER["PHP_SELF"]."?newdate=".$prevMonth .'"><img src="Images/prevmont_arrow.png" width="12" height="14" alt="προηγούμενος μήνας" /></a>';?> <tr> <td colspan="7"class="monthyea"><?php echo $monthNames[date("n", strtotime($newdate)) - 1] . ' ' . date("Y", strtotime($newdate)); ?></td> </tr> <?php echo '<a href="' . $_SERVER["PHP_SELF"] . "?newdate=" . $nextMonth . '"><img src="Images/nextmont_arrow.png" width="12" height="14" alt="επόμενος μήνας" /></a>';?> <tr> <td align="center" >ΔΕ</td> <td align="center" >ΤΡ</td> <td align="center" >ΤΕ</td> <td align="center" >ΠΕ</td> <td align="center" >ΠΑ</td> <td align="center" >ΣΑ</td> <td align="center">ΚΥ</td> </tr> <?php//////////////////week days $startdate = date("N", $month); // numeric value of day sat = 6, sunday = 7 $totaldays_in_mon = date("t", $month); $prev_totaldays_in_mon = date("t", $month - 1); $prev_mon_residue = ($prev_totaldays_in_mon - $startdate) + 2; $datecount = 0; $colcout = 0;//αυτή είναι η στήλη $rowcount = 0; $next_month_residue = 0; for ($date = 1; $date < ($totaldays_in_mon + $startdate); $date++) { $colcout++; if ($colcout == 1) { ?> <!-- εδώ ...πρέπει να μπεί το class για την περίπτωση όπου υφίσταται month view --> <tr class="john" > <?php } if ($date >= $startdate) { $datecount++; if ($colcout == 6 || $colcout == 7) { $cellclass = "weekend"; } else { $cellclass = "weekdays"; } if(isset ($_GET['week'])||isset ($_GET['weekview'])) { if(($monday->format('j')) == $datecount) {echo '<tr>'; for ($k =0; $k <7; $k++) if ((date("d") == ($datecount+$k)) && (date("n") == (date("n", strtotime($newdate))))) echo "<td class='current-day-highlited' align='center' valign='middle' height='20px'>" .($datecount+$k)."</td>\n"; else echo "<td class='weekgreen' align='center' valign='middle' height='20px'>" .($datecount+$k). "</td>\n"; echo '</tr>'; } if(($datecount>=($monday->format('j')))&&($datecount<=($sunday->format('j')))) continue; 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=".$cellclass.'id=dateid_'.$year.str_pad(date('m',$month),2,'0',STR_PAD_LEFT).str_pad($datecount,2,'0',STR_PAD_LEFT).'>'.$datecount."</td>"; } elseif((date("d",strtotime($newdate))==$datecount)&&(date("d")==$datecount)&&(date("n")==(date("n", strtotime($newdate))))) echo "<td class='nav-cur-highlited' align='center' valign='middle' height='20px'>".$datecount."</td>\n"; elseif((date("d") == $datecount)&& (date("n") == (date("n", strtotime($newdate))))) echo "<td class='current-day-highlited' align='center' valign='middle' height='20px'>" .$datecount. "</td>\n"; elseif (date("d", strtotime($newdate)) == $datecount) echo "<td class='navigation-day-highlited' align='center' valign='middle' height='20px'>" .$datecount. "</td>\n"; else {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>";} ?> <?php } elseif ($colcout == 6 || $colcout == 7) { ?> <td class="mon_weekend_residue"><?php echo $prev_mon_residue; ?></td> <?php } else { ?> <td class="mon_weekdays_residue"><?php echo $prev_mon_residue; ?></td> <?php $prev_mon_residue++; } if ($colcout % 7 == 0) { $colcout = 0; $rowcount++; echo '</tr>'; } } if ($colcout < 7 && $colcout != 0) { for ($emptycells = $colcout; $emptycells < 7; $emptycells++) { $next_month_residue++; if ($emptycells == 5 || $emptycells == 6) { echo '<td class="mon_weekend_residue">' .κ. $next_month_residue . '</td>'; } else { echo '<td class="mon_weekdays_residue">' .κ. $next_month_residue . '</td>'; } } echo '</tr>'; $rowcount++; } } $currentmon = $mon; } ?> </table> <?php } $currentyear = $year; } } The problem, as seen in the photo is that when highlighting the week-in the end/beginning of the month-the calendar is ruined.For example, now that we are in the last week of the April the first days of May are gone-which otherwise ought to be shown there.Other similar problems arise also when i navigate from week to week which are not shown here. Bottom line:I am trying to figure out code to highlight the week without problems,not just the current but also the one the user goes by navigation in a future/past date. Thanks and sorry for the lengthy code above
  19. jimfog

    array suntax...

    here is a piece of code-related to arrays- which i am having difficulty understanding it and i would appreciate some help for($=0;$i<$lists;$i++){ echo ....$list[i][0] } There is also some other code but the above is enough for what i want to ask. Why $list[0] has both [0] in front of it? The 0 is to access the first element of the array, what is the role of the loopcounter i there? I think it is there to access all the elements of the array one by one but how exactly does it achieve that by having the counterleft from the array index--[0]?
  20. jimfog

    what debugger

    Ok, all in all, you are saying that installing components separately is better(since some are not needed)-and not difficult.And another thing, since I already have 3 local sites,do you thing it will be difficult to transfer them in this new setting you are mentioning. This last is what bothers me most.
  21. jimfog

    what debugger

    Good explanation Are you sure this is the way to go, in other words you are saying to get rid of XAMPP, yes, but what if XAMP offers some features that are really needed and this ad hoc solution you propose does not. I have set 3 local sites with XAMPP and I am intimidated having to set up these again "manually". I am just asking.
  22. jimfog

    what debugger

    I just run this tool here http://xdebug.org/wizard.php and here is the message i get: The compiler (MS VC6) that this PHP was build with, is no longer supported. Please upgrade to a version that was built with MS VC9. It seems there is a problem with the compiler and i cannot install xdebug unless upgrading. The question is how i upgrade the compiler, do i just upgrade PHP(i have PHP 5.3 running on XAMPP)? I have never upgraded PHP on XAMP, how am i going to do it? Do i just unzip in the specified folder? P.S One last question, since PHP is interpreted why a compiler is needed?
  23. jimfog

    what debugger

    Since i do not use zend ide i will use xdebug
  24. jimfog

    what debugger

    I am using netbeans to develop PHP applications and now i am in search of a good debugger. In the Netbeans site Xdebug is proposed as a debugger but i am interested also on what you have to say. Thanks.
×
×
  • Create New...