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)
|
||||
|
||||
|
|
|
@ -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,8 +97,6 @@ header
|
|||
&:hover
|
||||
background: $secondary
|
||||
|
||||
|
||||
|
||||
.container
|
||||
z-index: 2
|
||||
background: $white
|
||||
|
@ -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,9 +191,6 @@ header
|
|||
font-size: 1.5em
|
||||
line-height: 1.3
|
||||
|
||||
|
||||
|
||||
|
||||
footer
|
||||
background: $white
|
||||
padding: 10px
|
||||
|
@ -198,7 +205,6 @@ footer
|
|||
a
|
||||
color: $secondary
|
||||
|
||||
|
||||
// RESPONSIVE
|
||||
|
||||
@media only screen and (max-width: 640px)
|
||||
|
@ -229,7 +235,6 @@ header
|
|||
.recent, .featured
|
||||
width: 100% !important
|
||||
|
||||
|
||||
@media only screen and (max-width: 375px)
|
||||
header
|
||||
nav
|
||||
|
|
|
@ -15,4 +15,3 @@ h2
|
|||
h3
|
||||
font-size: 1.5em
|
||||
font-weight: 300
|
||||
|
||||
|
|
Loading…
Reference in a new issue