From ecea2f0f54e1738d4983388fdc7b989b22695573 Mon Sep 17 00:00:00 2001 From: ceceprawiro Date: Thu, 28 Sep 2017 14:48:52 +0700 Subject: [PATCH] Penambahan entri di settings.php --- app/container.php | 2 +- app/settings.php.disable | 3 +++ app/src/Libraries/ViewExtension.php | 13 ++++++++-- app/views/layouts/system.php | 26 ++++++++++---------- app/views/sections/footer.php | 24 +++++++++--------- app/views/sections/header.php | 38 ++++++++++++++--------------- 6 files changed, 59 insertions(+), 47 deletions(-) diff --git a/app/container.php b/app/container.php index 1880017..84c7114 100644 --- a/app/container.php +++ b/app/container.php @@ -150,7 +150,7 @@ $view->loadExtension(new Libraries\ViewExtension( $request = $container->get('request'), $container->get('flash'), - $settings->get('mode') + $settings )); $view->loadExtension(new Projek\Slim\PlatesExtension($container->get('router'), $request->getUri())); diff --git a/app/settings.php.disable b/app/settings.php.disable index 16fe122..8038ade 100644 --- a/app/settings.php.disable +++ b/app/settings.php.disable @@ -6,6 +6,9 @@ return [ 'name' => 'PHP Indonesia - Membership App', 'email' => '', ], + 'mainsite' => [ + 'domain' => 'phpindonesia.id', + ], 'db' => [ 'host' => 'localhost', 'driver' => 'mysql', diff --git a/app/src/Libraries/ViewExtension.php b/app/src/Libraries/ViewExtension.php index 758ce21..20d6717 100644 --- a/app/src/Libraries/ViewExtension.php +++ b/app/src/Libraries/ViewExtension.php @@ -23,16 +23,23 @@ class ViewExtension implements ExtensionInterface */ protected $mode; + /** + * @var array + */ + protected $settings; + /** * View Extention * * @param \Slim\Http\Request $request */ - public function __construct(Request $request, FlashMessage $flash, $mode = 'development') + public function __construct(Request $request, FlashMessage $flash, $settings) { $this->request = $request; $this->flash = $flash; - $this->mode = $mode; + $this->settings = $settings; + + $this->mode = $this->settings->get('mode'); } /** @@ -45,6 +52,8 @@ public function register(Engine $engine) 'validation_errors' => [], 'base_js' => [], 'base_css' => [], + + 'mainsite' => $this->settings->get('mainsite'), ]); // Form helpers diff --git a/app/views/layouts/system.php b/app/views/layouts/system.php index f4f2058..cd2bcfa 100644 --- a/app/views/layouts/system.php +++ b/app/views/layouts/system.php @@ -10,19 +10,19 @@ PHP Indonesia | Membership - - - + + + - - + + - +