aboutsummaryrefslogtreecommitdiff
path: root/templates/timeline.inc.php
diff options
context:
space:
mode:
authorArno Richter <oelna@oelna.de>2023-01-13 14:32:18 +0100
committerArno Richter <oelna@oelna.de>2023-01-13 14:32:18 +0100
commitb20cf03c18ad06a5d9df4fa7bc61734fc57ba41b (patch)
treeccfff72643c3a3fd2831a8884618634a7fb5ec6c /templates/timeline.inc.php
parent04bffab6639fb3678ccb043b6e17e957d1ea662e (diff)
downloadmicroblog-b20cf03c18ad06a5d9df4fa7bc61734fc57ba41b.tar.gz
microblog-b20cf03c18ad06a5d9df4fa7bc61734fc57ba41b.tar.bz2
microblog-b20cf03c18ad06a5d9df4fa7bc61734fc57ba41b.zip
more efficient attachment retrival from DB for timeline rendering.
Diffstat (limited to 'templates/timeline.inc.php')
-rw-r--r--templates/timeline.inc.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/templates/timeline.inc.php b/templates/timeline.inc.php
index 6dd37c1..d07776d 100644
--- a/templates/timeline.inc.php
+++ b/templates/timeline.inc.php
@@ -52,14 +52,14 @@
</ul><?php endif; ?>
</nav>
<div class="post-content"><?= nl2br(autolink($post['post_content'])) ?></div>
- <?php if(!empty($attachments)): ?>
+ <?php if(!empty($attachments) && !empty($attachments[$post['id']])): ?>
<?php
- $attachments_total = count($attachments);
+ $attachments_total = count($attachments[$post['id']]);
// only display the first attachment on the timeline
- array_splice($attachments, 1);
+ array_splice($attachments[$post['id']], 1);
?>
<ul class="post-attachments">
- <?php foreach($attachments as $a): ?>
+ <?php foreach($attachments[$post['id']] as $a): ?>
<li title="<?= ($attachments_total > 1) ? 'and '.($attachments_total-1).' more' : '' ?>">
<?php if(strpos($a['file_mime_type'], 'image') === 0): ?>
<?php