Example #1
0
  function echoAside(){
    $items = JoomlaArticleModel::getList();
    $old_sec=null;
    $old_cat=null;
    echo "<ul class='homenav'>";
    while($item = $items->getAssoc()) 
    { 
      if($item["cat_title"] != $old_cat)
      {
	//A new section, make a new header
	if($old_cat!=null) echo "</ul></li>"; //Close the old cat
	if($old_sec!=null) echo "</ul></li>"; //Close the old section
 	echo "<li>";
	echo "<a href='#'>".$item["cat_title"]."</a>";
	echo "<ul class='homenav-category'>";
	$old_cat=$item["cat_title"];
	$old_sec=null;
      }

      if($item["sec_id"] != $old_sec)
      {
	//A new section, make a new header
	if($old_sec!=null) echo "</ul></li>"; //Close the old section
 	echo "<li>";
	echo "<a href='#'>".$item["sec_title"]."</a>";
 	echo "<ul class='homenav-section'>";
	$old_sec=$item["sec_id"];
      }

      echo "<li><a class='homenav-item' href='?jarticle=".$item["id"]."' >";
      echo $item["title"];
      echo "</a></li>";
    }
    echo "</ul>";
  }
Example #2
0
    return $result->fetch_assoc();
  }
  static function getList($params=null) {
    $sql = "SELECT con.title, con.id,
		    cat.id AS cat_id, cat.title AS cat_title,
		    sec.id AS sec_id, sec.title AS sec_title 
	    FROM jos_content AS con 
	    JOIN jos_categories AS cat ON con.catid=cat.id 
	    JOIN jos_sections AS sec ON sec.id=cat.section
	    ORDER BY cat.title DESC, sec.id";
    $result = self::$database->query($sql);
    return new JoomlaArticleModelList($result);
  }
} 

class JoomlaArticleModelList {
  private $result;
  function __construct($result){
    $this->result = $result;
  }
  function getAssoc(){
    return $this->result->fetch_assoc();
  }
  function getCount(){
    return $this->result->num_rows;
  }
  //abstract function reset();
}

JoomlaArticleModel::$database = new mysqli($config["database_host"], $config["database_user"], $config["database_password"], $config["database_joomla"]); 
Example #3
0
 function __construct($request) {
   $articleId = intval($request["jarticle"]);
   $this->article = JoomlaArticleModel::getInstance($articleId);
 }