From 4bb529679151502e3c466f24b98dcbb6cc989da2 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 24 Mar 2013 18:04:43 +0100 Subject: [PATCH] themes now with css + fallback. + two themes by Gabriel Wanzek. Todo: place themes-folder outside application-dir. todo: fallback for css-carabiner. --- AUTHORS.md | 1 + htdocs/application/.htaccess | 1 - htdocs/application/config/routes.php | 2 + .../application/controllers/theme_assets.php | 40 ++ .../themes/default/views/defaults/header.php | 3 +- .../themes/default/views/view/view_footer.php | 2 +- .../application/themes/gabdark/css/main.css | 525 +++++++++++++++++ .../application/themes/gabdark3/css/main.css | 557 ++++++++++++++++++ 8 files changed, 1128 insertions(+), 3 deletions(-) delete mode 100644 htdocs/application/.htaccess create mode 100755 htdocs/application/controllers/theme_assets.php create mode 100644 htdocs/application/themes/gabdark/css/main.css create mode 100644 htdocs/application/themes/gabdark3/css/main.css diff --git a/AUTHORS.md b/AUTHORS.md index a10a34c..a0b03ad 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -6,3 +6,4 @@ * Alexander https://github.com/sanek (Adding JSON-API) * abma https://github.com/abma (.htaccess improvement) * Chris https://github.com/ch0wnag3 (favicon URL improvement) +* Gabriel Wanzek https://github.com/GabrielWanzek (gabdark & gabdark3 themes) diff --git a/htdocs/application/.htaccess b/htdocs/application/.htaccess deleted file mode 100644 index 14249c5..0000000 --- a/htdocs/application/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all \ No newline at end of file diff --git a/htdocs/application/config/routes.php b/htdocs/application/config/routes.php index 755c3d6..46c678a 100644 --- a/htdocs/application/config/routes.php +++ b/htdocs/application/config/routes.php @@ -64,5 +64,7 @@ $route['iphone/view/:any'] = 'iphone/view'; $route['404_override'] = 'main/error_404'; +$route['application/themes/:any'] = 'theme_assets/css'; + /* End of file routes.php */ /* Location: ./application/config/routes.php */ diff --git a/htdocs/application/controllers/theme_assets.php b/htdocs/application/controllers/theme_assets.php new file mode 100755 index 0000000..fce89d1 --- /dev/null +++ b/htdocs/application/controllers/theme_assets.php @@ -0,0 +1,40 @@ +uri->segment(5); + $css_file = str_replace('.css', '', $css_file); + + //file path + $file_path = 'application/themes/' . $theme . '/css/' . $css_file . '.css'; + + //fallback to default css if view in theme not found + + if (!file_exists($file_path)) + { + $file_path = 'application/themes/default/css/' . $css_file . '.css'; + } + + //get and send + $contents = file_get_contents($file_path); + header('Content-type: text/css'); + echo $contents; + } +} diff --git a/htdocs/application/themes/default/views/defaults/header.php b/htdocs/application/themes/default/views/defaults/header.php index 19f7456..a89bc1c 100755 --- a/htdocs/application/themes/default/views/defaults/header.php +++ b/htdocs/application/themes/default/views/defaults/header.php @@ -7,6 +7,7 @@ if(isset($title)) $page_title .= $title . ' - '; } $page_title .= $this->config->item('site_name'); +$theme = $this->config->item('theme'); ?> @@ -18,7 +19,7 @@ $page_title .= $this->config->item('site_name'); //Carabiner $this->carabiner->config(array( 'script_dir' => 'static/js/', - 'style_dir' => 'static/styles/', + 'style_dir' => 'application/themes/' . $theme . '/css/', 'cache_dir' => 'static/asset/', 'base_uri' => base_url(), 'combine' => true, diff --git a/htdocs/application/themes/default/views/view/view_footer.php b/htdocs/application/themes/default/views/view/view_footer.php index 5064784..d518b38 100755 --- a/htdocs/application/themes/default/views/view/view_footer.php +++ b/htdocs/application/themes/default/views/view/view_footer.php @@ -1,4 +1,4 @@ - load->view('defaults/footer_message.php'); ?> + load->view('defaults/footer_message'); ?>