Added newest pastes panel

This commit is contained in:
pikami 2016-06-09 17:03:23 +00:00
parent 8dfcd52e7e
commit 0c79aa1cb0
2 changed files with 19 additions and 3 deletions

View File

@ -1,11 +1,11 @@
<div class="container">
<div class="container-fluid">
<div class="row">
<div class="col-sm-6">
<div class="col-sm-9">
<?php include "NewPastePanel.php"; ?>
</div>
<div class="col-sm-6" style="background-color:pink;">
<p>Placeholder</p>
<div class="col-sm-3">
<?php include "NewestPastes.php"; ?>
</div>
</div>
</div>

16
NewestPastes.php Normal file
View File

@ -0,0 +1,16 @@
<div class="panel panel-default">
<div class="panel-body">
<h4>Newest pastes:</h4>
<div class="list-group">
<?php
include "config/config.php";
$stmt = $conn->query('SELECT * FROM pastes ORDER BY id DESC LIMIT 5');
while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$title = $row['title'];
if(strlen($title)>25)$title = substr($title,0,25)."...";
echo "<a href=\"".$row['id']."\" class=\"list-group-item\">".$title."</a>";
}
?>
</div>
</div>
</div>