<?php // No direct access to this file defined('_JEXEC') or die('Restricted access'); function generateRow($city) { return XmlTagHelper::formatTableRow(array(XmlTagHelper::formatTableCell($city->name), XmlTagHelper::formatTableCell($city->service))); } function generateTableData($cities) { $tableData = array(); foreach ($cities as $city) { $tableData[] = generateRow($city); } return $tableData; } $xmlTag = new XmlTag(); $xmlTag->H1(JText::_('COM_REOMI_VIEW_CITIES_PAGE_TITLE'))->P(JText::_('COM_REOMI_VIEW_CITIES_PAGE_DESC'))->BR(); if (isset($this->cities)) { $tableContent = generateTableData($this->cities); $xmlTag->TABLE(array('class' => 'table table-striped table-hover'), $xmlTag()->THEAD($xmlTag()->TR($xmlTag()->TH(JText::_('COM_ROEMI_VIEW_CITIES_TABLE_HEADER_CITY'))->TH(JText::_('COM_ROEMI_VIEW_CITIES_TABLE_HEADER_SERVICE'))))->TBODY($xmlTag()->__fromArray($tableContent))); } else { $xmlTag->P(JText::_('COM_ROEMI_VIEW_CITIES_EMPTY_TABLE_MSG')); } echo $xmlTag;