initial
This commit is contained in:
31
include/projects.php
Normal file
31
include/projects.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
include 'renderer.php';
|
||||
|
||||
class Projects extends Renderer {
|
||||
protected function generateContent(): void {
|
||||
$query = 'SELECT p.short_title, p.description, pt.caption
|
||||
FROM project p
|
||||
JOIN project_type pt
|
||||
ON pt.id = p.project_type_id
|
||||
ORDER BY pt.order_id, p.short_title';
|
||||
$dbResult = mysqli_query($this->dbConnection, $query);
|
||||
$previousSection = '';
|
||||
$output = '';
|
||||
while ($row = mysqli_fetch_assoc($dbResult)) {
|
||||
if ($row['caption'] != $previousSection) {
|
||||
if ($output !== '') {
|
||||
$output .= '</ul>';
|
||||
}
|
||||
$output .= '<h3>' . $row['caption'] . '</h3><ul>';
|
||||
$previousSection = $row['caption'];
|
||||
}
|
||||
$output .= '<li>' . $row['short_title'];
|
||||
if (trim($row['description']) != '') {
|
||||
$output .= ' - ' . $row['description'];
|
||||
}
|
||||
$output .= '</li>';
|
||||
}
|
||||
$output .= '</ul>';
|
||||
$this->content['projects'] = $output;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user