PDA

View Full Version : how to display 12 month?


caballonegro
08-29-2002, 11:11 AM
Hello @ all

i need your help for the right code in case to display a calender with 12 month

I try a version but this is not very fast.
I call 12 times the escaleder.php file for each month.






echo "<table border="0" width="606" height="210" cellspacing="0" cellpadding="0" &nbsp;bgcolor="A8CFE5" &nbsp;>";

&nbsp; &nbsp;echo "<tr>";

&nbsp; &nbsp;echo "<td width="100"valign="top" >";readfile($_mycalenderurl."/calender/escalendar.php?".$useconfig[0]."&es=".$allstarts."&ee=".$allends); &nbsp;echo " </td>";

&nbsp; &nbsp;echo "<td width="100"valign="top" >";readfile($_mycalenderurl."/calender/escalendar.php?".$useconfig[1]."&es=".$allstarts."&ee=".$allends); &nbsp;echo " </td>";

&nbsp; &nbsp;echo "<td width="100"valign="top" >";readfile($_mycalenderurl."/calender/escalendar.php?".$useconfig[2]."&es=".$allstarts."&ee=".$allends); &nbsp;echo " </td>";

&nbsp; &nbsp;echo "<td width="100"valign="top" >";readfile($_mycalenderurl."/calender/escalendar.php?".$useconfig[3]."&es=".$allstarts."&ee=".$allends); &nbsp;echo " </td>";

&nbsp; &nbsp;echo "<td width="100"valign="top" >";readfile($_mycalenderurl."/calender/escalendar.php?".$useconfig[4]."&es=".$allstarts."&ee=".$allends); &nbsp;echo " </td>";

&nbsp; &nbsp;echo "<td width="100"valign="top" >";readfile($_mycalenderurl."/calender/escalendar.php?".$useconfig[5]."&es=".$allstarts."&ee=".$allends); &nbsp;echo "</td>";

&nbsp; &nbsp;echo "</tr>";

&nbsp; &nbsp;echo "<tr>";

&nbsp; &nbsp;echo "<td width="100"valign="top" >";readfile($_mycalenderurl."/calender/escalendar.php?".$useconfig[6]."&es=".$allstarts."&ee=".$allends); &nbsp;echo " </td>";

&nbsp; &nbsp;echo "<td width="100"valign="top" >";readfile($_mycalenderurl."/calender/escalendar.php?".$useconfig[7]."&es=".$allstarts."&ee=".$allends); &nbsp;echo " </td>";

&nbsp; &nbsp;echo "<td width="100"valign="top" >";readfile($_mycalenderurl."/calender/escalendar.php?".$useconfig[8]."&es=".$allstarts."&ee=".$allends); &nbsp;echo " </td>";

&nbsp; &nbsp;echo "<td width="100"valign="top" >";readfile($_mycalenderurl."/calender/escalendar.php?".$useconfig[9]."&es=".$allstarts."&ee=".$allends); &nbsp;echo "</td>";

&nbsp; &nbsp;echo "<td width="100"valign="top" >";readfile($_mycalenderurl."/calender/escalendar.php?".$useconfig[10]."&es=".$allstarts."&ee=".$allends); &nbsp;echo "</td>";

&nbsp; &nbsp;echo "<td width="100"valign="top" >";readfile($_mycalenderurl."/calender/escalendar.php?".$useconfig[11]."&es=".$allstarts."&ee=".$allends); &nbsp;echo "</td>";

&nbsp; &nbsp;echo "</tr>";

&nbsp; &nbsp;echo "</table>";

&nbsp; &nbsp;

Is there a way to do it faster or with less code??

thanks
8O

dtripp
09-05-2002, 06:21 PM
How about:
<?php



echo "<table border='1'>n";

for ($i = 1; $i <= 12; $i++) {



if ($i % 4 == 1) {

&nbsp;echo "<tr>n";

}



echo " <td align='center' valign='top'>";



$URL = "http://<your_domain_name_and_path_here>/escalendar.php?mo=$i&ny=1";

include($URL);



echo "</td>n";



if ($i % 4 == 0) {

&nbsp;echo "</tr>n";

}

}

echo "<tr>n";

echo "</table>n";

?>

dtripp
09-16-2002, 01:55 AM
Hmm. The above worked great on my Linux web server, but not at all on my Windows dev. box. So, after a bit of futzing... I'll suggest this:

If you want to send more variables to the calendar, then put 'em right before the include.



<?php



echo "<table border='1'>n";

for ($iMonth = 1; $iMonth <= 12; $iMonth++) {



if ($iMonth % 4 == 1) {

&nbsp;echo "<tr>n";

}



echo " <td align='center' valign='top'>";



$mo=$iMonth;

$ny=1;

include("escalendar.php");

echo "</td>n";



if ($iMonth % 4 == 0) {

&nbsp;echo "</tr>n";

}

}

echo "<tr>n";

echo "</table>n";

?>