Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

Having trouble with the output/structure of a nested Array in PHP and MySQL -


im trying make neat, structured list of, in case, films , showdates.

$shows = array(     array(         "thursday" => array(             "17:00",             "19:00")),     array(         "friday" => array(             "16:30",             "18:45"             "20:10")),     array(         "saturday" => array(             "18:30",             "21:00")) ); 

the problem cant seem able print things out in reasonable way. days supposed dynamic, not hard corded of case.

for ($row = 0; $row < $shows.length(); $row++) //haven't got clue 'length()' {     print $shows[$row] . "<br>"; //print day.      (     $col = 0; $col < $shows[$row].length(); $col++) //loop through each day.     {         print (">" . $shows[$row][$col] . "<br>"); //print each time of day.     }  } 

and im trying print out each day corresponding times. should come out this.

thursday - 17:00            19:00  friday   - 16:30            18:45            20:10 

foreach ($shows $show) {     foreach ($show $day => $times) {         echo $day;         foreach ($times $time) {             echo $time;         }     } } 

but, really, should simplify little this:

$shows = array(     array('day' => 'saturday', 'times' => array('17:00', '19:00')),     … );  foreach ($shows $show) {     echo $show['day'];     foreach ($show['times'] $time) {         echo $time;     } } 

or, , in computer parseable manner:

$shows = array(     strtotime('2010-12-24 17:00:00'),     strtotime('2010-12-24 19:00:00'),     … );  $lastdate = null; foreach ($shows $show) {     if (!$lastdate || date('y-m-d', $show) != date('y-m-d', $lastdate)) {         echo date('l', $show);     }     echo date('h:i', $show);     $lastdate = $show; } 

:o)


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -