0
클라이언트의 일정/일정을 만들고 있는데, 프론트 엔드 개발자이고 PHP로 완전히 새로 작성한 것 같습니다. 지금 곧 날짜가 상단에 분류되는 작업을 가지고있는 http://www.nrg-agency.com/events/새 일정에서 만료 된 날짜가있는 PHP 캘린더
스크립트는 기본 실제이며, 먼저 가장 멀리 날짜에 분류되었다 :
이 내가 가진 것입니다.
제 질문은, 과거 이벤트가 "과거 이벤트"와 함께 새 div에 자동으로 생성된다는 것을 어떻게 제 수립 할 수 있습니까?
<?php
function init_db(){
global $db;
$sql = "SHOW TABLES FROM $db[db]";
$result = mysql_query($sql);
$buildNow = 'yes';
while($row = mysql_fetch_row($result)){
if($row[0] == 'joe_cal_events'){
$buildNow = 'no';
}
}
if($buildNow == 'yes'){
mysql_query("
CREATE TABLE `joe_cal_events` (
`id` mediumint(8) NOT NULL auto_increment,
`start` date NOT NULL default '2014-30-04',
`end` date NOT NULL default '2020-01-01',
`title` text NOT NULL,
`url` text NOT NULL,
`description` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
") or die(mysql_error());
}
}
foreach ($dataArray as $key => $row) {
$orderByDate[$key] = strtotime($row['start']);
}
array_multisort($orderByDate, SORT_ASC, $dataArray);
array_multisort($orderByDate, SORT_ASC, $dataArray);
function prettyDate($date,$type){
list($y,$m,$d) = explode("-", $date);
if($type == 1){
return "$m/$d/$y";
}
if($type == 2){
return(date("j F Y",mktime(0,0,0,$m,$d,$y)));
}
}
?>
그리고이 내 events.php에서 :
이것은 내가 내 "Functions.php"파일에있어 무엇
<body>
";
$q = mysql_query("select * from joe_cal_events order by start asc");
while($r = mysql_fetch_array($q)){
print "
<div class='feedEkList'><li>
<div class='itemTitle'>$r[title]</div>
<div class='itemdate'>".prettyDate($r[start],2)."</div>
";
if($r[description]){
print "<div class='itemText'>$r[description]</div>";
}
print "
</li>
</div>
";
}
print "
</div>
</body>
다시 한 번 감사드립니다!
감사합니다! 하지만 제가 말했듯이 저는 PHP로 완전히 새로운 것입니다. 제 코드를 좀 살펴 보시겠습니까? 그리고 이것을 HTML에 어떻게 추가할까요? – MBouwman
@MBouwman 답글을 업데이트했습니다. $ r 대신 $ event와 같은 완전한 단어를 사용합니다. 왜냐하면 더 읽기 쉽기 때문입니다. 다른 프로그래머가 코드를 보면 쉽게 이해할 수 있습니다. –