七行プログラミング (452レス)
上下前次1-新
抽出解除 レス栞
438(4): 2007/12/01(土)02:02 ID:??? AAS
月次移動可能なカレンダー。c.phpで保存。
<?php $a=q("Y-m-t","$_GET[y]-1");$d=explode("-",$a);$y="<a href=?y=";$v=$d[0];
$w=$d[1];$z="</tr><tr>";$m="$v-$w";$p=q("Y-m",$w-1,1,$v);$n=q("Y-m",$w+1,1,$v)
;echo"<html>$y$p><</a>$m$y$n>></a> $y c.php>now</a><table border=1><tr>$z";$f=
q("w","$m-1");for($i=-6-$f;$i<$d[2]-q("w",$a)+7;$i++){echo($i<1-$f)?"<th>".q(
"D",$w,$i,$v)."</th>":(($i<1||$i>$d[2])?"<td></td>":"<td>$i</td>");if(($i+$f)%
7==0)echo$z;}echo"</tr></table></html>";function q($x,$w,$i=0,$v=0){return($i)
?date($x,mktime(0,0,0,$w,$i,$v)):date($x,strtotime($w));}?>
439(1): 2007/12/06(木)09:44 ID:??? AAS
>>438
「now」も要らんと思う。
<?php list($v,$w,$d)=explode("-",$a=q("$_GET[y]-1","Y-m-t"));$f=q("$v-$w-1","w"
);echo$l="<a href=?y=",q($w-1,"Y-m",1,$v),"><</a>$v-$w$l",q($w+1,"Y-m",1,$v)
,">></a> $l>now</a><table><tr>";for($i=-6-$f;$i<$d-q($a,"w")+7;){echo$i<1-$f
?"<th>".q($w,"D",$i,$v)."</th>":"<td>".(($i<1||$i>$d)?"":$i)."</td>";if(($i++ +
$f)%7==0)echo"</tr><tr>";}function q($w,$x,$i=0,$v=0){return date($x,$i?mktime(
0,0,0,$w,$i,$v):strtotime($w));}?></tr></table>
PHPは不得手なんで、これよりもっと縮む筈。
440: 438 2007/12/08(土)01:17 ID:??? AAS
>>439
凄いですね。いろんなことができるんだ、と感心しきり。
少しだけ縮めた。
<?php list($v,$w,$d)=explode("-",$a=q("$_GET[y]-1","Y-m-t"));$f=q("$v-$w-1","w"
);echo$l="<a href=?y=",q($w-1,"Y-m",1),"><</a>$v-$w$l",q($w+1,"Y-m",1),">></a>
$l>now</a><table><tr>";for($i=-6-$f;$i<$d-q($a,"w")+7;){echo$i<1-$f?"<th>".q($w
,"D",$i)."</th>":"<td>".($i<1||$i>$d?"":$i)."</td>";if(($f+$i++)%7==0)echo"</tr
><tr>";}function q($w,$x,$i=0){global$v;return date($x,$i?mktime(0,0,0,$w,$i,$v
):strtotime($w));}?></tr></table>
441: 438 2007/12/08(土)02:02 ID:??? AAS
手抜きバージョン。取り合えず表示されるみたいなので…
<?php function q($w,$x,$i=0){global$v;return date($x,$i?mktime(0,0,0,$w,$i,$v):
strtotime($w));}list($v,$w,$d)=explode("-",$a=q("$_GET[y]-1","Y-m-t"));echo$l="
<a href=?y=",q($w-1,"Y-m",1),"><</a>$v-$w$l",q($w+1,"Y-m",1),">></a> $l>now</a>
<table><tr>";for($i=-6-$f=q("$v-$w-1","w");$i<32;){echo$i<1-$f?"<th>".q($w,"D",
$i)."</th>":"<td>".($i<1||$i>$d?"":$i)."</td>";if(($f+$i++)%7==0)echo"</tr><tr>
";}?></tr></table>
442: 438 2007/12/08(土)02:37 ID:??? AAS
HTMLダメダメの超手抜きバージョン。無理やり5行にしてみた。
<?php list($v,$w,$d)=explode("-",q("$_GET[y]-1","Y-m-t"));echo$l="<a href=?y=",
q($w-1,"Y-m",1),"><</a>$v-$w$l",q($w+1,"Y-m",1),">></a> $l>now</a><table>";for(
$i=-6-$f=q("$v-$w-1","w");$i<32;){echo$i<1-$f?"<th>".q($w,"D",$i)."</th>":"<td>
".($i<1||$i>$d?"":$i)."</td>";if(($f+$i++)%7==0)echo"</tr><tr>";}function q($w,
$x,$i=0){global$v;return date($x,$i?mktime(0,0,0,$w,$i,$v):strtotime($w));}?>
上下前次1-新書関写板覧索設栞歴
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ
ぬこの手 ぬこTOP 0.022s