Fix references to params

This commit is contained in:
Yarmo Mackenbach 2020-06-22 20:15:38 +02:00
parent 44758ce307
commit 0d08508971

View File

@ -57,7 +57,7 @@ $variables = [
// If we are dealing with the home page
if ($match['name'] == 'home') {
$variables['posts'] = getBlogPosts($variables['params']);
$variables['posts'] = getBlogPosts($match['params']);
$variables['title'] = 'Blog — '.$basetitle;
// $variables['icons'] = getIcons();
}
@ -68,8 +68,8 @@ if ($match['name'] == 'about') {
// If we are dealing with the rss feed
if ($match['name'] == 'rss' || $match['name'] == 'rss-all' || $match['name'] == 'rss-xml') {
$blogposts = getBlogPosts($variables['params']);
$notes = getNotes($variables['params']);
$blogposts = getBlogPosts($match['params']);
$notes = getNotes($match['params']);
$variables['posts'] = array_merge($blogposts, $notes);
$variables['feed']['title'] = "Yarmo's blog and notes";
$variables['feed']['description'] = "Blog and notes feed for yarmo.eu discussing homelab and selfhosted stuff";
@ -78,7 +78,7 @@ if ($match['name'] == 'rss' || $match['name'] == 'rss-all' || $match['name'] ==
}
// If we are dealing with the blog rss feed
if ($match['name'] == 'rss-blog') {
$variables['posts'] = getBlogPosts($variables['params']);
$variables['posts'] = getBlogPosts($match['params']);
$variables['feed']['title'] = "Yarmo's blog";
$variables['feed']['description'] = "Blog feed for yarmo.eu discussing homelab and selfhosted stuff";
$variables['feed']['url'] = "https://yarmo.eu/blog";
@ -86,7 +86,7 @@ if ($match['name'] == 'rss-blog') {
}
// If we are dealing with the notes rss feed
if ($match['name'] == 'rss-notes') {
$variables['posts'] = getNotes($variables['params']);
$variables['posts'] = getNotes($match['params']);
$variables['feed']['title'] = "Yarmo's blog";
$variables['feed']['description'] = "Notes feed for yarmo.eu discussing homelab and selfhosted stuff";
$variables['feed']['url'] = "https://yarmo.eu/notes";
@ -110,13 +110,13 @@ if ($match['name'] == 'now') {
// If we are dealing with the blog
if ($match['name'] == 'blog') {
$variables['posts'] = getBlogPosts($variables['params']);
$variables['posts'] = getBlogPosts($match['params']);
$variables['title'] = 'Blog — '.$basetitle;
}
// If we are dealing with the notes
if ($match['name'] == 'notes') {
$variables['posts'] = getNotes($variables['params']);
$variables['posts'] = getNotes($match['params']);
$variables['title'] = 'Notes — '.$basetitle;
}
@ -127,10 +127,10 @@ if (($match['name'] == 'blog_post') || ($match['name'] == 'notes_post')) {
// If we are dealing with a post
if ($match['name'] == 'post') {
$variables['params']['slug'] = $match['params']['slug'];
$variables['post'] = getBlogPosts($variables['params']);
$match['params']['slug'] = $match['params']['slug'];
$variables['post'] = getBlogPosts($match['params']);
if (count($variables['post']) == 0) {
$variables['post'] = getNotes($variables['params']);
$variables['post'] = getNotes($match['params']);
}
if (count($variables['post']) > 0) {
$variables['post'] = $variables['post'][0];
@ -142,14 +142,14 @@ if ($match['name'] == 'post') {
// If we are dealing with the projects
if ($match['name'] == 'projects') {
$variables['projects'] = getProjects($variables['params']);
$variables['projects'] = getProjects($match['params']);
$variables['title'] = 'Projects — '.$basetitle;
}
// If we are dealing with a project's details
if ($match['name'] == 'projects_details') {
$variables['params']['slug'] = $match['params']['slug'];
$variables['project'] = getProjects($variables['params']);
$match['params']['slug'] = $match['params']['slug'];
$variables['project'] = getProjects($match['params']);
$variables['project'] = $variables['project'][0];
$variables['title'] = htmlspecialchars_decode(str_replace('·','·',$variables['project']['title'])).' — '.$basetitle;
}