Skip to content

Commit

Permalink
page for all records
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir-xz committed Jun 16, 2024
1 parent 618fe7a commit 2a467ae
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
9 changes: 9 additions & 0 deletions public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@
return $this->get('renderer')->render($response, 'url.phtml', $params);
});

$app->get('/urls', function ($request, $response, $args) {
$engine = new Engine('url', 'get');
$urls = $engine->process();
$params = [
'urls' => $urls,
];
return $this->get('renderer')->render($response, 'urls.phtml', $params);
});

$app->post('/urls', function ($request, $response) {
$validator = new Validator();
$url = $request->getParsedBodyParam('url');
Expand Down
19 changes: 19 additions & 0 deletions view/urls.phtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<a href="/">Url</a>

<?php var_dump($url)?>

<table>
<?php foreach ($urls as $url) : ?>
<tr>
<td>
<p>Ид: <?= htmlspecialchars($url['id'])?>;</p>
</td>
<td>
<p>Имя: <?= htmlspecialchars($url['name'])?>;</p>
</td>
<td>
<p>Дата: <?= htmlspecialchars($url['created_at'])?>;</p>
</td>
</tr>
<?php endforeach ?>
</table>

0 comments on commit 2a467ae

Please sign in to comment.