People, well, at least tell me where you can ask for help ... or read on the topic ..

Dear developers, advise, please, how best to display a selection of data from the SQL table cms Joomla 3.5 in a certain div of the relevant material? The administrative part of the component is already ready, but I cannot figure it out yet with this output of the user part. Details: there is a common SQL table with a list of services, in which one of the fields corresponds to a material label. It is necessary in a certain material div (servicelist) to display the name of the service and the price (columns item and price of the SQL table) containing only those records whose label (section) is equal to the material label. The output is needed in tabular form with the checkbox in the last column. Model Code:
class PricelistModelPricelist extends JModelList {

protected function getListQuery() { $db = JFactory::getDbo(); $query = $db->getQuery(TRUE); //SELECT .... $query->select('`item`,`price`,`section`'); //FROM $query->from('#__pricelist'); //WHERE $query->where('`published` = 1,'); //ORDER BY $query->order('`item` ASC'); return $query; } 

View Code:
class PricelistViewPricelist extends JViewLegacy {

  protected $items; function display($tpl = null) { $this->items = $this->get('Items'); parent::display($tpl); } } 

And the waters with the template code views ... \ tmpl \ default.php - I can not figure it out already:

 <?php if(!empty($this->items) && is_array($this->items)) :?> <?php foreach($this->items as $item) :?> <div class="pricelist1"> </div> <?php endforeach;?> <?php endif;?> 

    1 answer 1

    try:

     <?php if(!empty($this->items) && is_array($this->items)) { ?> <?php foreach($this->items as $item) { ?> <div class="pricelist1"> </div> <?php } ?> <?php } ?> 
    • @Ivan Turcan Thank you! There are no errors on the console, but the output does not work. I can not understand the possible reasons :(: even the sample is not reflected in the source code of the page - Anton