1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-09 06:36:52 +02:00

Theme Simple:

- Using Assets Component for css and js
- New head meta added: description, keywords, robots, generator
- Meta charset getting from registry site.charset
- Fixed issue with broken paths for JS
This commit is contained in:
Awilum
2018-05-29 16:26:13 +03:00
parent 2ac5dc7cc0
commit 936b0fad6b
2 changed files with 16 additions and 8 deletions

View File

@@ -1,14 +1,16 @@
<?php
namespace Flextype;
use Flextype\Component\{Event\Event, Http\Http, Registry\Registry};
use Flextype\Component\{Event\Event, Http\Http, Registry\Registry, Assets\Assets, Text\Text};
?>
<!doctype html>
<html lang="<?php echo Registry::get('site.locale'); ?>">
<head>
<meta charset="utf-8">
<meta charset="<?php echo Text::lowercase(Registry::get('site.charset')); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="<?php echo Registry::get('site.description'); ?>">
<meta name="author" content="">
<meta name="description" content="<?php echo (isset($page['description']) ? $page['description'] : Registry::get('site.description')); ?>">
<meta name="keywords" content="<?php echo (isset($page['keywords']) ? $page['keywords'] : Registry::get('site.keywords')); ?>">
<meta name="robots" content="<?php echo (isset($page['robots']) ? $page['robots'] : Registry::get('site.robots')); ?>">
<meta name="generator" content="Powered by Flextype <?php echo Flextype::VERSION; ?>" />
<?php Event::dispatch('onThemeMeta'); ?>
@@ -16,7 +18,11 @@
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700' rel='stylesheet' type='text/css'>
<link href="<?php echo Http::getBaseUrl(); ?>/site/themes/<?php echo Registry::get('site.theme'); ?>/assets/dist/css/simple.css" rel="stylesheet">
<?php Assets::add('css', Http::getBaseUrl() . '/site/themes/' . Registry::get('site.theme') . '/assets/dist/css/bootstrap.min.css', 'site', 1); ?>
<?php Assets::add('css', Http::getBaseUrl() . '/site/themes/' . Registry::get('site.theme') . '/assets/dist/css/simple.min.css', 'site', 2); ?>
<?php foreach (Assets::get('css', 'site') as $assets_by_priorities) { foreach ($assets_by_priorities as $assets) { ?>
<link href="<?php echo $assets['asset']; ?>" rel="stylesheet">
<?php } } ?>
<?php Event::dispatch('onThemeHeader'); ?>
</head>

View File

@@ -1,7 +1,9 @@
<?php
namespace Flextype;
use Flextype\Component\{Event\Event, Http\Http, Registry\Registry};
use Flextype\Component\{Event\Event, Http\Http, Registry\Registry, Assets\Assets};
?>
<script src="<?php echo Http::getBaseUrl(); ?>/site/themes/<?php echo Registry::get('site.theme'); ?>/node_modules/jquery/dist/jquery.slim.min.js"></script>
<script src="<?php echo Http::getBaseUrl(); ?>/site/themes/<?php echo Registry::get('site.theme'); ?>/node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<?php Assets::add('js', Http::getBaseUrl() . '/site/themes/' . Registry::get('site.theme') . '/assets/dist/js/simple.min.js', 'site', 1); ?>
<?php foreach (Assets::get('js', 'site') as $assets_by_priorities) { foreach ($assets_by_priorities as $assets) { ?>
<script src="<?php echo $assets['asset']; ?>"></script>
<?php } } ?>
<?php Event::dispatch('onThemeFooter'); ?>