Moved the main site pages into folders for better project structure

This commit is contained in:
Gregory Ballantine
2016-11-28 18:10:55 -05:00
parent 1c9a802a3c
commit b46551625d
12 changed files with 6 additions and 6 deletions

7
app/routes/pages/about.php Executable file
View File

@ -0,0 +1,7 @@
<?php
$app->get('/about', function() use($app) {
$app->render('pages/about.twig');
})->name('about');

7
app/routes/pages/contact.php Executable file
View File

@ -0,0 +1,7 @@
<?php
$app->get('/contact', function() use($app) {
$app->render('pages/contact.twig');
})->name('contact');

7
app/routes/pages/home.php Executable file
View File

@ -0,0 +1,7 @@
<?php
$app->get('/home', function() use($app) {
$app->render('pages/home.twig');
})->name('home');

View File

@ -0,0 +1,7 @@
<?php
$app->get('/', function() use($app) {
$app->response->redirect($app->urlFor('home'), '303');
})->name('index');

27
app/routes/pages/music.php Executable file
View File

@ -0,0 +1,27 @@
<?php
// music design #1
$app->get('/music1', function() use($app) {
$albums = $app->album->all()->sortByDesc('release_date')->values()->all();
$songs = $albums[0]->songs;
$app->render('pages/music1.twig', [
'albums' => $albums,
'songs' => $songs,
]);
})->name('music1');
# music design #2
$app->get('/music2', function() use($app) {
$albums = $app->album->all()->sortByDesc('release_date')->values()->all();
$songs = $albums[0]->songs;
$app->render('pages/music2.twig', [
'albums' => $albums,
'songs' => $songs,
]);
})->name('music2');

32
app/routes/pages/shows.php Executable file
View File

@ -0,0 +1,32 @@
<?php
$app->get('/shows', function() use($app) {
$shows = json_decode(file_get_contents('http://api.bandsintown.com/artists/HALFtone/events.json?api_version=2.0&app_id=shows_halftoneband.com'));
foreach ($shows as $show) {
$show->date = date('M dS', strtotime($show->datetime));
$show->day = date('D', strtotime($show->datetime));
$show->time = date('H:i', strtotime($show->datetime));
}
$app->render('pages/shows.twig', [
'shows' => $shows,
]);
})->name('shows');
$app->get('/shows/json', function() use($app) {
$shows = json_decode(file_get_contents('http://api.bandsintown.com/artists/HALFtone/events.json?api_version=2.0&app_id=shows_halftoneband.com'));
foreach ($shows as $show) {
$show->date = date('M dS', strtotime($show->datetime));
$show->day = date('D', strtotime($show->datetime));
$show->time = date('H:i', strtotime($show->datetime));
print_r($show);
echo '<br /><br />';
}
die();
})->name('shows.json');