<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Problema calendario php]]></title><description><![CDATA[<p dir="auto">Ciao, ho trovato su internet un piccolo script in php per un calendario... l'unico problema è che è quadrato... mentre io avrei bisogno che fosse rettangolare cioè non in base ai giorni dal lunedì alla domenica ma in base ai giorni di calendario avendo solo due righe una con i giorni del mese (1,2,3,4,...., 31) e una con i giorni della settimana (L,M,M,G,V,S,D)...<br />
Ho provato a modificare i paramenti da solo ma dopo molti tentativi (alla cieca) mi sto arrendendo...<br />
Qualcuno sa come modificarlo? Almeno per farlo uscire rettangolare invece che quadrato?<br />
Grazie mille<br />
Ciao</p>
<pre><code class="language-php">&lt;?php 

// if ym is set, i.e. somebody clicked on next or previous months link 
if(isset($_GET["ym"])) 
{ 
    $year = (int)substr($_GET["ym"], 0, 4); 
    $month = (int)substr($_GET["ym"], 4, 2); 
} 
else    // otherwise take current month &amp; year 
{ 
    $month = date("m", mktime(0,0,0,date('m'),1,date('Y'))); 
    $year = date("Y", mktime(0,0,0,date('m'),1,date('Y'))); 
} 

$skip = date("w", mktime(0,0,0,$month,1,$year)); // days to skip in 1 row of week. 
$daysInMonth = date("t", mktime(0,0,0,$month,1,$year));    // total number of dates in the month. 
$calendar_head = '';    // for calendar head 
$calendar_body = '';    // for calendar boday 
$day = 1;    // For date in calendar 

for($i = 0; $i &lt; 6; $i++) // Outer loop for weeks 
{ 
    $calendar_body .= '&lt;tr&gt;';    // start row tag 
    for($j = 0; $j &lt; 7; $j++)    // Inner loop for week days 
    { 
        if(($skip &gt; 0)||($day &gt; $daysInMonth)) // display blank till 1 day of month or after total numnber of days in that month 
        { 
            $calendar_body .= '&lt;td&gt;&amp;nbsp;&lt;/td&gt;';  
            $skip--; 
        } 
        else 
        { 
            if($j == 0)    // if its Sunday then add class holiday 
                $calendar_body .= '&lt;td class="holiday"&gt;'.$day.'&lt;/td&gt;';  
            else    // otherwise add day class 
                $calendar_body .= '&lt;td class="day"&gt;'.$day.'&lt;/td&gt;';  
                 
            $day++; // Increment $day 
        } 
         
    }    // inner loop closes 
    $calendar_body .= '&lt;/tr&gt;'; // end row tag 
} // outer loop closes 

// Calendar head section 
$calendar_head = ' 
  &lt;tr&gt;       
    &lt;th colspan="2"&gt;&lt;a href="?ym='.date("Ym", mktime(0,0,0,$month-1,1,$year)).'"&gt;&amp;laquo; Previous Month&lt;/a&gt;&lt;/th&gt; 
      &lt;th colspan="3"&gt;'.date("F, Y", mktime(0,0,0,$month,1,$year)).'&lt;/th&gt; 
      &lt;th colspan="2"&gt;&lt;a href="?ym='.date("Ym", mktime(0,0,0,$month+1,1,$year)).'"&gt;Next Month &amp;raquo;&lt;/a&gt;&lt;/th&gt; 
  &lt;/tr&gt; 
  &lt;tr&gt; 
    &lt;th&gt;Sunday&lt;/th&gt; 
    &lt;th&gt;Monday&lt;/th&gt; 
    &lt;th&gt;Tuesday&lt;/th&gt; 
    &lt;th&gt;Wednesday&lt;/th&gt; 
    &lt;th&gt;Thursday&lt;/th&gt; 
    &lt;th&gt;Friday&lt;/th&gt; 
    &lt;th&gt;Saturday&lt;/th&gt; 
  &lt;/tr&gt;'; 
// PHP code for calendar ends 
   
?&gt; 
   
&lt;head&gt; 
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt; 
&lt;title&gt;A Calendar Built in PHP&lt;/title&gt; 

&lt;style type="text/css"&gt; 

#calendar tbody tr{ height:100px; } 
#calendar td{ width:100px; } 
#calendar th{background-color:#CCCC99;} 
.day{ background-color:#CCFFCC; } 
.holiday{ background-color:#FFCC66; } 

&lt;/style&gt; 

&lt;/head&gt; 

&lt;body&gt; 

&lt;h2&gt;A Calendar Built in PHP&lt;/h2&gt; 

&lt;!-- Table to display calendar --&gt; 
&lt;table id="calendar" width="710" border="1" cellspacing="0" cellpadding="5"&gt; 
&lt;thead&gt;  
  &lt;?php echo $calendar_head; ?&gt; 
&lt;/thead&gt; 
&lt;tbody&gt; 
    &lt;?php echo $calendar_body; ?&gt; 
&lt;/tbody&gt; 
&lt;/table&gt; 
&lt;!-- Table to display calendar --&gt; 

&lt;/body&gt; 
&lt;/html&gt;
</code></pre>
]]></description><link>https://dev.connect.gt/topic/171078/problema-calendario-php</link><generator>RSS for Node</generator><lastBuildDate>Wed, 25 Nov 2026 19:55:18 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/171078.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 14 May 2012 08:52:22 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problema calendario php on Tue, 15 May 2012 11:03:50 GMT]]></title><description><![CDATA[<blockquote>
<p dir="auto"><strong>Cyrus</strong></p>
<p dir="auto">Nel post sopra non ti ho copiato la parte in html dato che rimane identica (dal tag &lt;head&gt; in avanti)</p>
</blockquote>
<p dir="auto">si una cosa del genere solo che esciono delle tabelle in più che sono vuote... mentre i giorni del mese dovrebbero corrispondere ai giorni della settimana...<br />
Ho provato anche io così ma si presentava tutto sballato <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/customizations/f71a0c43-865f-4388-9868-8b387eebeeb1-mmmm.gif?v=12b9555a9a1" class="not-responsive emoji emoji-customizations emoji--mmm" style="height:1.4em;width:auto;vertical-align:middle" title=":?" alt="" /></p>
]]></description><link>https://dev.connect.gt/post/1068947</link><guid isPermaLink="true">https://dev.connect.gt/post/1068947</guid><dc:creator><![CDATA[thaypan]]></dc:creator><pubDate>Tue, 15 May 2012 11:03:50 GMT</pubDate></item><item><title><![CDATA[Reply to Problema calendario php on Tue, 15 May 2012 09:08:46 GMT]]></title><description><![CDATA[<p dir="auto">Nel post sopra non ti ho copiato la parte in html dato che rimane identica (dal tag &lt;head&gt; in avanti)</p>
]]></description><link>https://dev.connect.gt/post/1068930</link><guid isPermaLink="true">https://dev.connect.gt/post/1068930</guid><dc:creator><![CDATA[cyrus]]></dc:creator><pubDate>Tue, 15 May 2012 09:08:46 GMT</pubDate></item><item><title><![CDATA[Reply to Problema calendario php on Tue, 15 May 2012 07:33:54 GMT]]></title><description><![CDATA[<p dir="auto">ciao, ho provato proprio ora il tuo script ma non va... uso EasyPHP... mi esce la pagina completamente bianca... come mai <img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/customizations/f71a0c43-865f-4388-9868-8b387eebeeb1-mmmm.gif?v=12b9555a9a1" class="not-responsive emoji emoji-customizations emoji--mmm" style="height:1.4em;width:auto;vertical-align:middle" title=":?" alt="" /> ?</p>
]]></description><link>https://dev.connect.gt/post/1068946</link><guid isPermaLink="true">https://dev.connect.gt/post/1068946</guid><dc:creator><![CDATA[thaypan]]></dc:creator><pubDate>Tue, 15 May 2012 07:33:54 GMT</pubDate></item><item><title><![CDATA[Reply to Problema calendario php on Mon, 14 May 2012 10:21:53 GMT]]></title><description><![CDATA[<p dir="auto">Ciao,<br />
intendevi in questa maniera?</p>
<pre><code class="language-php">&lt;?php 

// if ym is set, i.e. somebody clicked on next or previous months link 
if(isset($_GET["ym"])) 
{ 
    $year = (int)substr($_GET["ym"], 0, 4); 
    $month = (int)substr($_GET["ym"], 4, 2); 
} 
else    // otherwise take current month &amp; year 
{ 
    $month = date("m", mktime(0,0,0,date('m'),1,date('Y'))); 
    $year = date("Y", mktime(0,0,0,date('m'),1,date('Y'))); 
} 

$skip = date("w", mktime(0,0,0,$month,1,$year)); // days to skip in 1 row of week. 
$daysInMonth = date("t", mktime(0,0,0,$month,1,$year));    // total number of dates in the month. 
$calendar_head = '';    // for calendar head 
$calendar_body = '';    // for calendar boday 
$day = 1;    // For date in calendar 

$calendar_body .= '&lt;tr&gt;';
for($i = 0; $i &lt; 6; $i++) // Outer loop for weeks 
{ 
    //$calendar_body .= '&lt;tr&gt;';    // start row tag 
    for($j = 0; $j &lt; 7; $j++)    // Inner loop for week days 
    { 
        if(($skip &gt; 0)||($day &gt; $daysInMonth)) // display blank till 1 day of month or after total numnber of days in that month 
        { 
            $calendar_body .= '&lt;td&gt;&amp;nbsp;&lt;/td&gt;';  
            $skip--; 
        } 
        else 
        { 
            if($j == 0)    // if its Sunday then add class holiday 
                $calendar_body .= '&lt;td class="holiday"&gt;'.$day.'&lt;/td&gt;';  
            else    // otherwise add day class 
                $calendar_body .= '&lt;td class="day"&gt;'.$day.'&lt;/td&gt;';  
                 
            $day++; // Increment $day 
        } 
         
    }    // inner loop closes 
    //$calendar_body .= '&lt;/tr&gt;'; // end row tag 
} // outer loop closes 
$calendar_body .= '&lt;/tr&gt;';

// Calendar head section 
$calendar_head = ' 
  &lt;tr&gt;       
    &lt;th colspan="2"&gt;&lt;a href="?ym='.date("Ym", mktime(0,0,0,$month-1,1,$year)).'"&gt;&amp;laquo; Previous Month&lt;/a&gt;&lt;/th&gt; 
      &lt;th colspan="3"&gt;'.date("F, Y", mktime(0,0,0,$month,1,$year)).'&lt;/th&gt; 
      &lt;th colspan="2"&gt;&lt;a href="?ym='.date("Ym", mktime(0,0,0,$month+1,1,$year)).'"&gt;Next Month &amp;raquo;&lt;/a&gt;&lt;/th&gt; 
  &lt;/tr&gt; 
  &lt;tr&gt; ';
for($i = 0; $i &lt; 6; $i++) // Outer loop for weeks 
{   
	$calendar_head .= '
    &lt;th&gt;Sunday&lt;/th&gt; 
    &lt;th&gt;Monday&lt;/th&gt; 
    &lt;th&gt;Tuesday&lt;/th&gt; 
    &lt;th&gt;Wednesday&lt;/th&gt; 
    &lt;th&gt;Thursday&lt;/th&gt; 
    &lt;th&gt;Friday&lt;/th&gt; 
    &lt;th&gt;Saturday&lt;/th&gt;'; 
} // outer loop closes 

// PHP code for calendar ends 
   $calendar_head .= ' &lt;/tr&gt;';
?&gt;
</code></pre>
]]></description><link>https://dev.connect.gt/post/1068931</link><guid isPermaLink="true">https://dev.connect.gt/post/1068931</guid><dc:creator><![CDATA[cyrus]]></dc:creator><pubDate>Mon, 14 May 2012 10:21:53 GMT</pubDate></item></channel></rss>