public function getContentCatergoryAlias($alias) { $db = new Database(); $db->tables(); $results = $db->q("SELECT * FROM `{$db->categories}` WHERE alias = '{$alias}'"); $this->catid = $results[0]['id']; $results = $this->q("SELECT alias FROM `{$db->categories}` WHERE id = '{$this->catid}'"); $this->alias = $results[0]['alias']; $results = $this->q("SELECT id FROM `{$db->menu}` WHERE alias = '{$this->alias}'"); $this->itemId = $results[0]['id']; $results = $db->q("SELECT * FROM `{$db->content}` WHERE catid = '{$this->catid}' ORDER BY id DESC"); return $results; }
public function loadArticleByAlias($articleAlias, $routerId, $routerView, $routerCategoryParentId, $routerBase) { //Create new instance of the Joomla\Database Class $db = new Joomla\Database(); //Create new instance of the Joomla\Router class $router = new Joomla\Router(); //Select all table names from database //Remove table prefix and build variables for each table name in the database //e.g. -- $this->content woud output the content table name with the correct table prefix $db->tables(); //Set function variables to class variables //routerView can ether be article OR category OR categories $this->routerView = $routerView; //routerId can be one of two things //id of the article (if the routerView == article) OR category id (if the routerView == category OR categories) $this->routerId = $routerId; //articleAlias is the alias of the article //The alias is the title of the article but everything is converted to lowercase //All spaces converted into dashes //All speical characters are stripped as well $this->articleAlias = $articleAlias; //routerCategoryParentId is the categories parent id //If routerCategoryParentId is equal to 1 then use routerId $this->routerCategoryParentId = $routerCategoryParentId; //routerBase is the root url of the project //Where the Joomla files are located $this->routerBase = $routerBase; $query = $db->q("SELECT * FROM `{$db->content}` WHERE alias = '{$this->articleAlias}'"); //Loop through results from above query //Create variables for each column for access in the required file foreach ($query as $articleResultsKey => $articleResult) { foreach ($articleResult as $articleColumn => $articleData) { $this->{$articleColumn} = $articleData; } } //Get the category alias by the cat id variable generated from above in the foreach loop $query = $db->q("SELECT alias FROM `{$db->categories}` WHERE id = '{$this->catid}'"); //Assign a variable for the category alias $this->categoryAlias = $query[0]['alias']; //Build the routed path by the category alias and article alias //Stick the path inside of require require $router->buildArticleRoute($this->categoryAlias, $this->articleAlias); }
<?php use Antfuentes\Titan\Joomla; use Antfuentes\Titan\Framework; $menu = new Joomla\Menu(); $db = new Joomla\Database(); $string = new Framework\String(); $h = new Framework\Html(); $h->b('ul', 0, 1); $menu->build('mainmenu', 'li', 1); $db->tables(); $result = $db->q("SELECT * FROM {$db->categories} WHERE id = '{$this->categoryParentId}'"); $cleanAlias = $string->replaceString('-', '', $result[0]['alias']); $menu->build($cleanAlias, 'li', $this->routerId); $h->b('ul', 1, 1);
<?php require_once '../_define.php'; require_once '../vendor/autoload.php'; use Antfuentes\Titan\Joomla; $db = new Joomla\Database(); $db->tables(); $state = trim($_POST['cssId']); $results = $db->q("SELECT * FROM {$db->categories} WHERE alias = 'static'"); foreach ($results as $key => $data) { $explode = explode('/', $data['path']); $city = str_replace('-', '', $explode[1]); if ($state == $explode[0]) { $articleId = $data['id']; //temIdQuery = $db->q("SELECT id FROM $db->menu WHERE menutype = '$city' AND alias = 'home-$city'"); $contents = $db->q("SELECT * FROM {$db->content} WHERE catid = '{$articleId}' AND alias = 'home'"); foreach ($contents as $keyContent => $content) { $link = 'index.php?option=com_content&view=article&id=' . $content["id"]; echo '<a style="color: black; font-size: 5rem;" href="' . $link . '">' . $city . '</a>'; echo '<br>'; } } } /*$result = $db->q("SELECT id FROM $db->categories WHERE path = '$path'"); $id = $result[0]['id']; $results = $db->q("SELECT * FROM $db->categories WHERE parent_id = '$id' AND alias = 'static'"); $db->dump($results);*/ //foreach($results as $key => $data){
public function loadTemplate($dir, $results, $showLimit, $template) { $total = count($results["photos"]["photo"]); $pages = @$_GET["page"]; $pagesTotal = ceil($total / $showLimit); if ($pages < 1) { $pages = 1; } else { $pages; } $start = ($pages - 1) * $showLimit; $resultsSlices = array_slice($results["photos"]["photo"], $start, $showLimit); $this->pagesTotal = $pagesTotal; echo $total; $db = new Database(); $db->dump($resultsSlices); /*foreach($resultsSlices as $resultsKey => $resultSlice){ foreach ($resultSlice as $column => $data){ $this->{$column} = $data; } require($dir.'/'.$template.'.php'); }*/ }