updated template to handle file, style fixes
This commit is contained in:
parent
fd4ff2ea52
commit
a66377e597
7 changed files with 352 additions and 312 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,6 +6,7 @@ dist
|
|||
.DS_Store
|
||||
*.sublime-project
|
||||
*.sublime-workspace
|
||||
*.code-workspace
|
||||
assets
|
||||
vendor
|
||||
|
||||
|
|
|
@ -7,132 +7,151 @@ class ThemeEngine
|
|||
public $data = [];
|
||||
public $loader;
|
||||
public $twig;
|
||||
|
||||
public function __construct(string $themePath, string $themeAssetPath)
|
||||
{
|
||||
$var = [];
|
||||
$this->themePath = $themePath;
|
||||
$this->themeAssetPath = $themeAssetPath;
|
||||
$path = explode("/", $themeAssetPath);
|
||||
$path = explode('/', $themeAssetPath);
|
||||
$this->themeFolder = $path[4];
|
||||
$this->settings = json_decode(
|
||||
file_get_contents("./data/settings.json"),
|
||||
file_get_contents('./data/settings.json'),
|
||||
true
|
||||
);
|
||||
$this->posts = json_decode(file_get_contents("./data/posts.json"), true);
|
||||
$this->posts = json_decode(file_get_contents('./data/posts.json'), true);
|
||||
$this->archives = json_decode(
|
||||
file_get_contents("./data/archives.json"),
|
||||
file_get_contents('./data/archives.json'),
|
||||
true
|
||||
);
|
||||
$this->loader = new \Twig\Loader\FilesystemLoader(
|
||||
$themePath . "/" . $path[4]
|
||||
$themePath.'/'.$path[4]
|
||||
);
|
||||
$this->twig = new \Twig\Environment($this->loader, []);
|
||||
$this->router($_SERVER["REQUEST_URI"]);
|
||||
$this->router($_SERVER['REQUEST_URI']);
|
||||
}
|
||||
|
||||
public function router(string $request)
|
||||
{
|
||||
$pageInfo = [
|
||||
"keywords" => $this->settings["keywords"],
|
||||
"description" => $this->settings["description"],
|
||||
"image" => $this->themeAssetPath . "/assets/images/global/default-bg.jpg",
|
||||
'keywords' => $this->settings['keywords'],
|
||||
'description' => $this->settings['description'],
|
||||
'image' => $this->themeAssetPath.'/assets/images/global/default-bg.jpg',
|
||||
];
|
||||
|
||||
$featureList = explode(",", $this->posts["feature"]);
|
||||
$fileList = explode(",", $this->posts["files"]);
|
||||
$featureList = explode(',', $this->posts['feature']);
|
||||
$fileList = explode(',', $this->posts['files']);
|
||||
|
||||
$images = [];
|
||||
$files = [];
|
||||
foreach ($featureList as $file) {
|
||||
$item = trim($file);
|
||||
$ext = pathinfo($item, PATHINFO_EXTENSION);
|
||||
if ($item != null || $item != "") {
|
||||
array_push($images, ["file" => $item, "type" => trim($ext)]);
|
||||
if ($item != null || $item != '') {
|
||||
array_push($images, ['file' => $item, 'type' => trim($ext)]);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($fileList as $file) {
|
||||
$item = trim($file);
|
||||
$ext = pathinfo($item, PATHINFO_EXTENSION);
|
||||
if ($item != null || $item != "") {
|
||||
array_push($files, ["file" => $item, "type" => trim($ext)]);
|
||||
if ($item != null || $item != '') {
|
||||
array_push($files, ['file' => $item, 'type' => trim($ext)]);
|
||||
}
|
||||
}
|
||||
|
||||
$menu = $this->settings["menu"];
|
||||
$menu = $this->settings['menu'];
|
||||
switch ($request) {
|
||||
case "/":
|
||||
$recent = $this->posts["recent_posts"];
|
||||
$featured = $this->posts["featured_posts"];
|
||||
$template = "index.twig";
|
||||
$content = $this->posts["index-content"];
|
||||
case '/':
|
||||
$recent = $this->posts['recent_posts'];
|
||||
$featured = $this->posts['featured_posts'];
|
||||
$template = 'index.twig';
|
||||
$content = $this->posts['index-content'];
|
||||
|
||||
$pageOptions = [
|
||||
"debug" => true, //for theme kit
|
||||
"theme" => $this->themeFolder, //for theme kit
|
||||
"title" => "This is Fipamo",
|
||||
"dynamicRender" => $this->settings["dynamicRender"],
|
||||
"background" =>
|
||||
$this->themeAssetPath . "/assets/images/global/default-bg.jpg",
|
||||
"recent" => $recent,
|
||||
"featured" => $featured,
|
||||
"info" => $pageInfo,
|
||||
"menu" => $menu,
|
||||
"content" => $content,
|
||||
'debug' => true, // for theme kit
|
||||
'theme' => $this->themeFolder, // for theme kit
|
||||
'title' => 'This is Fipamo',
|
||||
'dynamicRender' => $this->settings['dynamicRender'],
|
||||
'background' => $this->themeAssetPath.'/assets/images/global/default-bg.jpg',
|
||||
'recent' => $recent,
|
||||
'featured' => $featured,
|
||||
'info' => $pageInfo,
|
||||
'menu' => $menu,
|
||||
'content' => $content,
|
||||
'media' => $images,
|
||||
'files' => $files,
|
||||
];
|
||||
break;
|
||||
case "/page":
|
||||
$content = $this->posts["content"];
|
||||
$meta = $this->posts["meta"];
|
||||
$template = $request . ".twig";
|
||||
case '/page':
|
||||
$content = $this->posts['content'];
|
||||
$meta = $this->posts['meta'];
|
||||
$template = $request.'.twig';
|
||||
$pageOptions = [
|
||||
"debug" => true, //for theme kit
|
||||
"theme" => $this->themeFolder, //for theme kit
|
||||
"title" => "Page Title",
|
||||
"dynamicRender" => $this->settings["dynamicRender"],
|
||||
"background" =>
|
||||
$this->themeAssetPath . "/assets/images/global/default-bg.jpg",
|
||||
"content" => $content,
|
||||
"meta" => $meta,
|
||||
"info" => $pageInfo,
|
||||
"menu" => $menu,
|
||||
"media" => $images,
|
||||
"files" => $files,
|
||||
'debug' => true, // for theme kit
|
||||
'theme' => $this->themeFolder, // for theme kit
|
||||
'title' => 'Page Title',
|
||||
'dynamicRender' => $this->settings['dynamicRender'],
|
||||
'background' => $this->themeAssetPath.'/assets/images/global/default-bg.jpg',
|
||||
'content' => $content,
|
||||
'meta' => $meta,
|
||||
'info' => $pageInfo,
|
||||
'menu' => $menu,
|
||||
'media' => $images,
|
||||
'files' => $files,
|
||||
];
|
||||
break;
|
||||
case "/tags":
|
||||
$tags = $this->settings["tag_list"];
|
||||
$template = $this->themeFolder . "/tags.twig";
|
||||
case '/tags':
|
||||
$tags = $this->settings['tag_list'];
|
||||
$template = 'tags.twig';
|
||||
$pageOptions = [
|
||||
"debug" => true, //for theme kit
|
||||
"theme" => $this->themeFolder, //for theme kit
|
||||
"title" => "Pages Tagged as Tag",
|
||||
"dynamicRender" => $this->settings["dynamicRender"],
|
||||
"background" =>
|
||||
$this->themeAssetPath . "/assets/images/global/default-bg.jpg",
|
||||
"tag_list" => $tags,
|
||||
"info" => $pageInfo,
|
||||
"menu" => $menu,
|
||||
'debug' => true, // for theme kit
|
||||
'theme' => $this->themeFolder, // for theme kit
|
||||
'title' => 'Pages Tagged as Tag',
|
||||
'dynamicRender' => $this->settings['dynamicRender'],
|
||||
'background' => $this->themeAssetPath.'/assets/images/global/default-bg.jpg',
|
||||
'tag_list' => $tags,
|
||||
'info' => $pageInfo,
|
||||
'menu' => $menu,
|
||||
'media' => $images,
|
||||
'files' => $files,
|
||||
];
|
||||
break;
|
||||
case "/archive":
|
||||
case '/archive':
|
||||
$archive = $this->archives;
|
||||
$template = $this->themeFolder . "/archive.twig";
|
||||
$template = 'archive.twig';
|
||||
$pageOptions = [
|
||||
"debug" => true, //for theme kit
|
||||
"theme" => $this->themeFolder, //for theme kit
|
||||
"title" => "Archive",
|
||||
"dynamicRender" => $this->settings["dynamicRender"],
|
||||
"background" =>
|
||||
$this->themeAssetPath . "/assets/images/global/default-bg.jpg",
|
||||
"archives" => $archive,
|
||||
"info" => $pageInfo,
|
||||
"menu" => $menu,
|
||||
'debug' => true, // for theme kit
|
||||
'theme' => $this->themeFolder, // for theme kit
|
||||
'title' => 'Archive',
|
||||
'dynamicRender' => $this->settings['dynamicRender'],
|
||||
'background' => $this->themeAssetPath.'/assets/images/global/default-bg.jpg',
|
||||
'archives' => $archive['archives'],
|
||||
'info' => $pageInfo,
|
||||
'menu' => $menu,
|
||||
'media' => $images,
|
||||
'files' => $files,
|
||||
];
|
||||
break;
|
||||
default:
|
||||
http_response_code(404);
|
||||
require __DIR__ . "/views/404.php";
|
||||
set_error_handler(function ($errno, $errstr, $errfile, $errline) {
|
||||
// throw new \ErrorException($errstr, $errno, 0, $errfile, $errline);
|
||||
$error = $errstr;
|
||||
});
|
||||
$template = 'error.twig';
|
||||
$pageOptions = [
|
||||
'debug' => true, // for theme kit
|
||||
'theme' => $this->themeFolder, // for theme kit
|
||||
'title' => 'Uh oh',
|
||||
'dynamicRender' => $this->settings['dynamicRender'],
|
||||
'background' => $this->themeAssetPath.'/assets/images/global/default-bg.jpg',
|
||||
'info' => $pageInfo,
|
||||
'content' => "Uh Oh, so there's a problem.",
|
||||
'menu' => $menu,
|
||||
'media' => $images,
|
||||
'files' => $files,
|
||||
];
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,12 +14,36 @@
|
|||
<div class="page">
|
||||
<p>{{content | raw}}</p>
|
||||
<div>
|
||||
<div class="page_files">
|
||||
<div class="page_doc">
|
||||
<strong>Files</strong><br/>
|
||||
{% for doc in files %}
|
||||
{% if doc.type != "mp3" %}
|
||||
{% set path = doc.file|split('/') %}
|
||||
<a href="{{doc.file}}">{{path[6]}}</a>
|
||||
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="page_sounds">
|
||||
<strong>Sounds</strong><br/>
|
||||
{% for doc in files %}
|
||||
{% if doc.type == "mp3" %}
|
||||
<audio controls>
|
||||
<source src="{{doc.file}}" type="audio/mpeg">
|
||||
Your browser does not support the audio element.
|
||||
</audio>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<br/>
|
||||
{{meta['who']}} dropped this {{ meta['when'] }}<br />
|
||||
<strong>tags: </strong>
|
||||
{% for tag in meta['tags'] %}
|
||||
{% if dynamicRender is defined %}
|
||||
{% if dynamicRender == 'false' %}
|
||||
{% if dynamicRender == 'true' %}
|
||||
<a href="{{ "/tags/"~tag.slug }}">{{ tag.label }}</a>
|
||||
{% else %}
|
||||
<a href="{{ "/tags/"~tag.slug~".html" }}">{{ tag.label }}</a>
|
||||
|
@ -28,6 +52,7 @@
|
|||
<a href="{{ "/tags/"~tag.slug~".html" }}">{{ tag.label }}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
|
|
|
@ -36,7 +36,7 @@ button, input[type=submit]
|
|||
cursor: pointer
|
||||
border: 0
|
||||
padding: 10px 0 5px 0
|
||||
@include object_transitions(.3s)
|
||||
transition: all 0.3s linear
|
||||
|
||||
select
|
||||
font: 14px $baseType
|
||||
|
@ -63,5 +63,3 @@ select
|
|||
:-ms-input-placeholder
|
||||
font: 25px $baseType
|
||||
color: $white
|
||||
|
||||
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
@mixin text-drop-shadow($rgb_value, $opacity, $offsetX, $offsetY, $blur)
|
||||
text-shadow: $offsetX $offsetY $blur rgba($rgb_value, $opacity)
|
||||
|
||||
@mixin object-transitions($rate)
|
||||
-moz-transition: all $rate linear
|
||||
-webkit-transition: all $rate linear
|
||||
-o-transition: all $rate linear
|
||||
transition: all $rate linear
|
||||
|
||||
|
||||
@mixin background-opacity($rgb_value, $opacity)
|
||||
background: rgba($rgb_value, $opacity)
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ html
|
|||
overflow: hidden
|
||||
font: 400 1.2em/1.4em $baseType
|
||||
|
||||
body
|
||||
body
|
||||
background: $white
|
||||
margin: 0
|
||||
padding: 0
|
||||
|
@ -17,7 +17,7 @@ body
|
|||
overflow-y: scroll
|
||||
overflow-x: hidden
|
||||
|
||||
a
|
||||
a
|
||||
color: $primary
|
||||
text-decoration: none
|
||||
border-bottom: 1px solid $highlight
|
||||
|
@ -25,26 +25,26 @@ a
|
|||
&:hover
|
||||
border-bottom: 1px solid $secondary
|
||||
|
||||
code
|
||||
code
|
||||
background: $black
|
||||
color: $highlight
|
||||
border-radius: 3px
|
||||
padding: 3px
|
||||
|
||||
pre
|
||||
pre
|
||||
background: $black
|
||||
color: $highlight
|
||||
border-radius: 3px
|
||||
padding: 3px
|
||||
code
|
||||
code
|
||||
color: $secondary
|
||||
background: none
|
||||
|
||||
svg.icons
|
||||
svg.icons
|
||||
width: 25px
|
||||
fill: $white
|
||||
|
||||
header
|
||||
header
|
||||
background: $primary
|
||||
height: 90%
|
||||
width: 100%
|
||||
|
@ -54,7 +54,7 @@ header
|
|||
height: 90%
|
||||
position: absolute
|
||||
.slide
|
||||
@include object-transitions(.7s)
|
||||
transition: all 0.7s linear
|
||||
width: 100%
|
||||
height: 100%
|
||||
position: absolute
|
||||
|
@ -97,9 +97,7 @@ header
|
|||
&:hover
|
||||
background: $secondary
|
||||
|
||||
|
||||
|
||||
.container
|
||||
.container
|
||||
z-index: 2
|
||||
background: $white
|
||||
line-height: 30px
|
||||
|
@ -124,11 +122,19 @@ header
|
|||
img
|
||||
display: block
|
||||
width: 100%
|
||||
h1
|
||||
h1, h2
|
||||
color: $primary
|
||||
p
|
||||
font: 300 1.25em/1.6em $baseType
|
||||
//meta datea for page
|
||||
.page_files
|
||||
.page_doc
|
||||
a
|
||||
background: $black
|
||||
border-radius: 3px
|
||||
color: $white
|
||||
padding: 3px
|
||||
margin: 0 5px 0 0
|
||||
.meta
|
||||
font: 500 0.8em/1.3em $baseType
|
||||
padding: 5px 0 0 0
|
||||
|
@ -164,6 +170,10 @@ header
|
|||
color: $white
|
||||
.index-lists, .page-title
|
||||
max-width: 840px
|
||||
width: 80%
|
||||
margin: 0 auto
|
||||
padding: 20px 0 0 0
|
||||
|
||||
span
|
||||
font-size: 2em
|
||||
color: $secondary
|
||||
|
@ -181,10 +191,7 @@ header
|
|||
font-size: 1.5em
|
||||
line-height: 1.3
|
||||
|
||||
|
||||
|
||||
|
||||
footer
|
||||
footer
|
||||
background: $white
|
||||
padding: 10px
|
||||
color: $primary
|
||||
|
@ -198,11 +205,10 @@ footer
|
|||
a
|
||||
color: $secondary
|
||||
|
||||
// RESPONSIVE
|
||||
|
||||
// RESPONSIVE
|
||||
|
||||
@media only screen and (max-width: 640px)
|
||||
header
|
||||
@media only screen and (max-width: 640px)
|
||||
header
|
||||
nav
|
||||
width: 98%
|
||||
span
|
||||
|
@ -214,8 +220,8 @@ header
|
|||
.archive-month
|
||||
width: 45%
|
||||
|
||||
@media only screen and (max-width: 480px)
|
||||
header
|
||||
@media only screen and (max-width: 480px)
|
||||
header
|
||||
nav
|
||||
width: 96%
|
||||
.container
|
||||
|
@ -229,12 +235,11 @@ header
|
|||
.recent, .featured
|
||||
width: 100% !important
|
||||
|
||||
|
||||
@media only screen and (max-width: 375px)
|
||||
header
|
||||
@media only screen and (max-width: 375px)
|
||||
header
|
||||
nav
|
||||
width: 95%
|
||||
.container
|
||||
.container
|
||||
article
|
||||
.index, .page
|
||||
margin: 0
|
||||
|
|
|
@ -15,4 +15,3 @@ h2
|
|||
h3
|
||||
font-size: 1.5em
|
||||
font-weight: 300
|
||||
|
||||
|
|
Loading…
Reference in a new issue