[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] [PHP] Event/kalender



Arkanoid wrote:
Det viker perfekt.... tak for hjælpen

En mere elegant løsning ville være, at hente data først i en løkke, og lave udskrift senere i en anden løkke. Her er et eksempel.

$events=array();
while($data=mysql_fetch_assoc($result)){
  $time = getdate($data['start']);
  $events[$time['mon']][$time['mday']][]=$data;
}


echo '<table>'; foreach($events as $month => $monthevents){ echo '<tr><td align="center" colspan="2"><div class="h2">'.transmonth($month).'</div></td></tr>'; foreach($maanedevents as $date => $dateevents){ echo '<tr><td align="center" width="15">'.$date.'</td><td>'; foreach($dateevents as $data){ echo '<a href="index.php?action=show&id='; echo $data['ID']. '" title="'. $data['title'] .'">'; echo $data['title'] . '</a><br>'; } echo '</td></tr>'; } } echo '</table>';

I det hele taget er det en god ide at prøve at adskille selve programlogikken fra præsentationslogikken.

Med venlig hilsen

Ole

 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:44 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *