Skip to content

Instantly share code, notes, and snippets.

@e06widu
Created July 9, 2013 14:27
Show Gist options
  • Select an option

  • Save e06widu/5957760 to your computer and use it in GitHub Desktop.

Select an option

Save e06widu/5957760 to your computer and use it in GitHub Desktop.
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the Joomla modellist library
jimport('joomla.application.component.modellist');
/**
* HelloWorldList Model
*/
class MyResourceListModelRegions extends JModelList
{
/**
* Method to build an SQL query to load the list data.
*
* @return string An SQL query
*/
protected function getListQuery()
{
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Select some fields
$query->select('reg.id as id,reg.Name as Name,reg.userId as userId,user.name as username');
// From the hello table
$query->from('#__region as reg');
$query->leftJoin("#__users as user on user.id= reg.userId");
return $query;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment