<?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[Problemi nella creazione di un calendario con php]]></title><description><![CDATA[<p dir="auto">Salve,</p>
<p dir="auto">ho intenzione di creare con php un calendario nel formato come quello di mkportal.</p>
<p dir="auto">Ho scritto sufficiente codice php ma non visualizza niente:</p>
<pre><code class="language-php">&lt;?php
class cal {

function __construct() {

}

function mkg($d) {
return(date('w', mktime(0, 0, 0, $this-&gt;dati['mese'], $d, $this-&gt;dati['anno'])));
}


function calendario() {
$this-&gt;dati = array(giorno =&gt; date('j'), bis =&gt; date('L'), mese =&gt; date('n'), gmese =&gt; date('t'), gsett =&gt; date('w'), setta =&gt; date('W'), anno =&gt; date('Y'), settm =&gt; round(date('t')/7)+1, gsett1 =&gt; date('w', mktime(0, 0, 0, date('n'), 1, date('Y'))));
$this-&gt;j = 0;

switch($this-&gt;dati['mese']) {
case 1: $this-&gt;mese = "Gennaio"; break;
case 2: $this-&gt;mese = "Febbraio"; break;
case 3: $this-&gt;mese = "Marzo"; break;
case 4: $this-&gt;mese = "Aprile"; break;
case 5: $this-&gt;mese = "Maggio"; break;
case 6: $this-&gt;mese = "Giugno"; break;
case 7: $this-&gt;mese = "Luglio"; break;
case 8: $this-&gt;mese = "Agosto"; break;
case 9: $this-&gt;mese = "Settembre"; break;
case 10: $this-&gt;mese = "Ottobre"; break;
case 11: $this-&gt;mese = "Novembre"; break;
case 12: $this-&gt;mese = "Dicembre"; break;
default: $this-&gt;mese = ""; break;
}

switch($this-&gt;dati['gsett']) {
case 0: $this-&gt;gsett = "Domenica"; break;
case 1: $this-&gt;gsett = "Luned&amp;igrave;"; break;
case 2: $this-&gt;gsett = "Marted&amp;igrave;"; break;
case 3: $this-&gt;gsett = "Mercoled&amp;igrave;"; break;
case 4: $this-&gt;gsett = "Gioved&amp;igrave;"; break;
case 5: $this-&gt;gsett = "Venerd&amp;igrave;"; break;
case 6: $this-&gt;gsett = "Sabato"; break;
default: $this-&gt;gsett = ""; break;
}


echo '&lt;table border="0" width="30%" height="30%"&gt;
&lt;tr&gt;
&lt;td width="100%" height="15%"&gt;'.$this-&gt;mese.' '.$this-&gt;dati['anno'].'&lt;/td&gt;
&lt;/tr&gt;';
for($this-&gt;i=0; $this-&gt;i&lt;$this-&gt;dati['settm']; $this-&gt;i++) {
$this-&gt;k = 0;
echo '&lt;tr&gt;
&lt;td width="14%" height="15%"&gt;';
if($this-&gt;j == 0) {
if($this-&gt;mkg($this-&gt;j+1) == 0) {
echo(++$this-&gt;j == $this-&gt;dati['giorno'] ? '('.$this-&gt;j.')' : $this-&gt;j);
}
}
else {
echo(++$this-&gt;j == $this-&gt;dati['giorno'] ? '('.$this-&gt;j.')' : $this-&gt;j);
}
if($this-&gt;j == 0) {
if($this-&gt;mkg($this-&gt;j+1) == 0) {
echo(++$this-&gt;j == $this-&gt;dati['giorno'] ? '('.$this-&gt;j.')' : $this-&gt;j);
}
}
else {
echo(++$this-&gt;j == $this-&gt;dati['giorno'] ? '('.$this-&gt;j.')' : $this-&gt;j);
}
if($this-&gt;j == 0) {
if($this-&gt;mkg($this-&gt;j+1) == 0) {
echo(++$this-&gt;j == $this-&gt;dati['giorno'] ? '('.$this-&gt;j.')' : $this-&gt;j);
}
}
else {
echo(++$this-&gt;j == $this-&gt;dati['giorno'] ? '('.$this-&gt;j.')' : $this-&gt;j);
}
if($this-&gt;j == 0) {
if($this-&gt;mkg($this-&gt;j+1) == 0) {
echo(++$this-&gt;j == $this-&gt;dati['giorno'] ? '('.$this-&gt;j.')' : $this-&gt;j);
}
}
else {
echo(++$this-&gt;j == $this-&gt;dati['giorno'] ? '('.$this-&gt;j.')' : $this-&gt;j);
}
if($this-&gt;j == 0) {
if($this-&gt;mkg($this-&gt;j+1) == 0) {
echo(++$this-&gt;j == $this-&gt;dati['giorno'] ? '('.$this-&gt;j.')' : $this-&gt;j);
}
}
else {
echo(++$this-&gt;j == $this-&gt;dati['giorno'] ? '('.$this-&gt;j.')' : $this-&gt;j);
}
if($this-&gt;j == 0) {
if($this-&gt;mkg($this-&gt;j+1) == 0) {
echo(++$this-&gt;j == $this-&gt;dati['giorno'] ? '('.$this-&gt;j.')' : $this-&gt;j);
}
}
else {
echo(++$this-&gt;j == $this-&gt;dati['giorno'] ? '('.$this-&gt;j.')' : $this-&gt;j);
}
if($this-&gt;j == 0) {
if($this-&gt;mkg($this-&gt;j+1) == 0) {
echo(++$this-&gt;j == $this-&gt;dati['giorno'] ? '('.$this-&gt;j.')' : $this-&gt;j);
}
}
else {
echo(++$this-&gt;j == $this-&gt;dati['giorno'] ? '('.$this-&gt;j.')' : $this-&gt;j);
}
echo '&lt;/td&gt;
&lt;/tr&gt;';
}
echo '&lt;/table&gt;';
}


}

$cal = new cal();
$cal-&gt;calendario();
?&gt;
</code></pre>
<p dir="auto">Ho voluto mettere anche il giorno di oggi tra parentesi per evidenziarlo, ma poi sistemerò io...</p>
<p dir="auto">Il problema è che non dà nessun errore ma come codice html restituisce questo:</p>
<pre><code class="language-html">&lt;table border="0" width="30%" height="30%"&gt;
&lt;tr&gt;
&lt;td width="100%" height="15%"&gt;Ottobre 2008&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td width="14%" height="15%"&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td width="14%" height="15%"&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td width="14%" height="15%"&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td width="14%" height="15%"&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;tr&gt;
&lt;td width="14%" height="15%"&gt;&lt;/td&gt;
&lt;/tr&gt;&lt;/table&gt;
</code></pre>
<p dir="auto">Mi sapete gentilmente correggereil codice php per fare venire un calendario decente?</p>
<p dir="auto">Grazie,<br />
<img src="https://dev.connect.gt/assets/plugins/nodebb-plugin-emoji/emoji/customizations/0541d916-a420-403e-bd97-1a1367eebdcf-hi-1.gif?v=12b9555a9a1" class="not-responsive emoji emoji-customizations emoji--gthi" style="height:1.4em;width:auto;vertical-align:middle" title=":gthi:" alt="" /></p>
]]></description><link>https://dev.connect.gt/topic/85488/problemi-nella-creazione-di-un-calendario-con-php</link><generator>RSS for Node</generator><lastBuildDate>Fri, 27 Nov 2026 13:33:14 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/85488.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 18 Oct 2008 18:17:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problemi nella creazione di un calendario con php on Fri, 24 Oct 2008 18:10:04 GMT]]></title><description><![CDATA[<p dir="auto">Non succede niente di nuovo, è sempre come prima... come risolvo?</p>
]]></description><link>https://dev.connect.gt/post/773678</link><guid isPermaLink="true">https://dev.connect.gt/post/773678</guid><dc:creator><![CDATA[jeeves]]></dc:creator><pubDate>Fri, 24 Oct 2008 18:10:04 GMT</pubDate></item><item><title><![CDATA[Reply to Problemi nella creazione di un calendario con php on Thu, 23 Oct 2008 19:29:32 GMT]]></title><description><![CDATA[<p dir="auto">potresti provare a cambiare questo</p>
<pre><code class="language-php">if($this-&gt;mkg($this-&gt;j+1) == 0)
</code></pre>
<p dir="auto">in questo</p>
<pre><code class="language-php">if($this-&gt;mkg(($this-&gt;j)+1) == 0)
</code></pre>
<p dir="auto">probabilmente le parentesi non rendono l'effetto voluto...</p>
]]></description><link>https://dev.connect.gt/post/773700</link><guid isPermaLink="true">https://dev.connect.gt/post/773700</guid><dc:creator><![CDATA[momino]]></dc:creator><pubDate>Thu, 23 Oct 2008 19:29:32 GMT</pubDate></item><item><title><![CDATA[Reply to Problemi nella creazione di un calendario con php on Wed, 22 Oct 2008 19:42:06 GMT]]></title><description><![CDATA[<p dir="auto">Meh? Nessuno? Perché non mi aiutate? Su avanti...</p>
<p dir="auto">Grazie</p>
]]></description><link>https://dev.connect.gt/post/773674</link><guid isPermaLink="true">https://dev.connect.gt/post/773674</guid><dc:creator><![CDATA[jeeves]]></dc:creator><pubDate>Wed, 22 Oct 2008 19:42:06 GMT</pubDate></item></channel></rss>