-
-
Save Plastickid/7ca29201ad9ce8f4cb9d1e6ebe82c13f to your computer and use it in GitHub Desktop.
Revisions
-
jonesch created this gist
Oct 5, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ //Use CSS to make these columns responsive. <ul class="food-menus<?=(' '.$menu_category)?>"> <?php //Let's get a count of how many items we are going to display of our menu $total_menu_categories = count($menu[$menu_category]); $total_items = $total_menu_categories; foreach($menu[$menu_category] as $section => $value) { $total_items = $total_items + count($value); } //get the total number of <li>s on our page $number_of_columns = 3; $ul_break_point = ceil($total_items/$number_of_columns); //start the counting, and looping $counter = 0; foreach($menu[$menu_category] as $section => $value) { if($section!='general'){ //general blurb for each category still counts as one item. echo '<li class="title">'.str_replace('-', ' ', $section).'</li>'; $counter++; } foreach($value as $item => $details) { //each category within the menu, and all it's items if($item=='overview'){ //overview of sub-category echo '<li class="overview">'.$details.'</li>'; $counter++; } else { //item title, information, price, description echo '<li><p'.(empty($details['price'])?' class="none"':'').'> <span class="title">'.$item.'</span> <span class="price">'.$details['price'].'</span> </p>'.(!empty($details['description'])?$details['description']:' ').'</li>'; $counter++; } if($counter % $ul_break_point == 0){ //when do we need to break. echo '</ul><ul class="food-menus '.$menu_category.'">'; } } } ?> </ul><!-- .menus lunch-menu -->