aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Cleberg <hello@cleberg.net>2023-06-01 09:56:33 -0500
committerChristian Cleberg <hello@cleberg.net>2023-06-01 09:56:33 -0500
commit243aae7b1778ae53b77d82f2e33a1037d6eb0a5c (patch)
treed378802b4c61ed7b265370b06aec9da6cfd2e883
parent1ae16f7987d553d26da0df0ef916c25ec173da91 (diff)
downloadhn-243aae7b1778ae53b77d82f2e33a1037d6eb0a5c.tar.gz
hn-243aae7b1778ae53b77d82f2e33a1037d6eb0a5c.tar.bz2
hn-243aae7b1778ae53b77d82f2e33a1037d6eb0a5c.zip
fix accidental line ends
-rw-r--r--index.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/index.php b/index.php
index fa92db9..8c6d8e7 100644
--- a/index.php
+++ b/index.php
@@ -177,16 +177,18 @@ function get_user(string $api_url, string $inline_title) {
$limit = count($response['submitted']) > 10 ? 10 : count($response['submitted']);
if (count($response['submitted']) > 0) {
for ($i = 0; $i < $limit; $i++) {
- $sub_url = 'https://hacker-news.firebaseio.com/v0/item/' . $response['submitted>
+ $sub_url = 'https://hacker-news.firebaseio.com/v0/item/' . $response['submitted][$i] . '.json';
$sub_response_raw = file_get_contents($sub_url);
$sub_response = json_decode($sub_response_raw, true);
// TODO: Create switch-case to cover a story, comment, job, poll, or pollopt
- $html = '<div><a href="' . $sub_response['url'] . '">' . $sub_response['title']>
- $html .= '<p><time datetime="' . date('Y-m-d h:m:s', $sub_response['time']) . '>
- $html .= date('Y-m-d h:m:s', $sub_response['time']) . '</time> by ';
- $html .= $sub_response['by'] . ' | ' . $sub_response['score'] . ' points</p></d>
- $html_output .= $html;
+ $html = '<div><a href="' . $sub_response['url'] . '">' . $sub_response['title'] . '</a>';
+ $html .= '<p><time datetime="' . date('Y-m-d h:m:s', $sub_response['time']) . '">';
+ $html .= date('Y-m-d h:m:s', $sub_response['time']) . '</time> by <a';
+ $html .= 'href="/user/'. $sub_response['by'] . '">';
+ $html .= $sub_response['by'] . ' | ' . $sub_response['score'];
+ $html .= 'points</p></div>';
+ $html_output .= $html;
}
} else {
$html_output .= '<p>User has no subsmissions.</p>';