V
V
Vladyslav Phenychnyi2016-04-18 18:27:42
PHP
Vladyslav Phenychnyi, 2016-04-18 18:27:42

How to set sorting?

Joomla has a module that displays contacts on one of the pages using List contacts in a category , but not in the order in which we would like. How to make it sort the contacts on the page in the order that was set in the backend in ordering?

<?php	 	
defined( '_JEXEC' ) or die( 'Restricted access' );
$db =& JFactory::getDBO();
?> 
<div id="ourexperts">
                <?php	 	
        $db =& JFactory::getDBO();
        $query = $db->getQuery(true);
        $query->select(' * ');
        $query->from('#__contact_details AS cd');
        $query->where('cd.catid = 12 and published=1 ');
        $db->setQuery($query);
        $ctg = $db->loadObjectList();
        foreach($ctg as $key=>$val){
      $links = 'index.php?option=com_contact&view=contact&id='.$val->id.':dr-'.$val->alias.'&catid='.$val->catid.'&Itemid=121';
        ?>
           	      <div class="dr_bx">
                    	<div class="dr_pic"><img src="thumb.php?file=<?php	 	 echo $val->image;?>&sizex=150&sizey=150"  /></div>
                        <div class="dr_details">
                        <h1><a href="<?php	 	 echo $links;?>"><?php	 	 echo $val->name;?></a></h1>
                        <h2><?php	 	 echo $val->con_position;?> </h2>
                        </div>
                    </div>
                   <?php	 	 } ?> 
 </div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav Shkaev, 2016-04-18
@proxid

so probably, you need to look in the database for which field index
$query->sortby('menuindex', 'ASC');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question