bananapapa1 |
02.03.2011 02:11 |
Табуляция и php
Вложений: 1
Доброй ночи. Подскажите, пожалуйста, как из списка меню блюд (картинка в приложении) сделать пункты меню h2 (LUNCH MENU, Dinner Menu и т.д.) каждый в отдельном табе?
код меню блюд списком сейчас такой:
if ($this->menus || $this->item->price) {
if ($this->item->price) {
echo $this->item->price;
}
if ($this->menus) {
echo '<div class="menuframe">' . "\n";
$margin = 60;
$k =0;
foreach ($this->menus as $menu) :
if ($menu->parent_id == 0) {
echo '<h2 style="text-align:center; margin-top:15px">'.JText::_($menu->title).'</h2>' . "\n";
echo '<div id="menutable">' . "\n";
} else if ($menu->parent_id = 0 && $menu->children > 0) {
echo '<h3 style="text-align:center; margin-bottom:5px;">'.JText::_($menu->title).'</h3>' . "\n";
echo '<div id="menutable">' . "\n";
} else {
if ($menu->backimage) {
$imagelink = JURI::base() .'images/restaurant/menu/restaurant_'.$menu->resto.'/resize/'.$menu->backimage;
} else {
if ($k == 0)
$imagelink = JURI::base() .'components/restaurant/assets/images/back_light.png';
else
$imagelink = JURI::base() .'components/restaurant/assets/images/back_dark.png';
}
if ($k == 0) {
if ($menu->backimage)
echo '<div class="table-row" style="height: '.$margin.'px; background: transparent url('.$imagelink.') 0 40px no-repeat;">' . "\n";
else
echo '<div class="table-row" style="height: '.$margin.'px; background: transparent url('.$imagelink.') 0 0 repeat;">' . "\n";
} else {
if ($menu->backimage)
echo '<div class="table-row" style="height: '.$margin.'px; background: transparent url('.$imagelink.') 100% 40px no-repeat;">' . "\n";
else
echo '<div class="table-row" style="height: '.$margin.'px; background: transparent url('.$imagelink.') 0 0 repeat;">' . "\n";
}
echo '<div class="leftcell">' . "\n";
echo '<div class="inner">' . "\n";
if (!$menu->backimage && $menu->image) {
echo '<a href="'.JURI::base().'images/restaurant/menu/restaurant_'.$menu->resto.'/album/'.$menu->image.'" rel="lightbox" title="'.$menu->title.'"><img class="listimage" style="border-color:'.$this->rgconf->bordercolor.'" src="'.JURI::base() .'images/restaurant/menu/restaurant_'.$menu->resto.'/thumb/' . $menu->image. '" alt="'.htmlentities($menu->title).'"/></a>';
}
echo '</div>' . "\n";
echo '</div>' . "\n";
echo '<div class="centercell" style="width:76%">' . "\n";
echo '<p>';
echo stripslashes($menu->title);
echo '</p>' . "\n";
if ($menu->description) {
echo '<p style="text-align:left;">';
echo stripslashes($menu->description);
echo '</p>' . "\n";
}
echo '</div>' . "\n";
if ($menu->price) {
echo '<div class="rightcell" style="width:150px; vertical-align: middle; padding-right:5px;">' . "\n";
echo '<p style="text-align:right;">';
echo stripslashes($menu->price);
echo '</p>' . "\n";
echo '</div>' . "\n";
}
echo '</div>' . "\n";
}
if ($menu->parent_id == 0) {
echo '</div>' . "\n";
} else if ($menu->parent_id > 0 && $menu->children > 0) {
echo '</div>' . "\n";
}
$k = 1 - $k;
endforeach;
echo '</div>' . "\n";
}
echo '</div>' . "\n";
echo '</div>' . "\n";
}
|