Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

theme detection #6

Open
wants to merge 1 commit into from

1 participant

@morficus

I added the ability to find assets in the theme folder as well (only if a theme is in place).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 0 deletions.
  1. +12 −0 views/helpers/asset.php
View
12 views/helpers/asset.php
@@ -367,6 +367,18 @@ function __findFile(&$asset, $type) {
$paths = array($this->__getPath($type));
$paths = array_merge($paths, $this->options['searchPaths']);
+ //checks if a theme is being used
+ if(!empty($this->theme))
+ {
+ //cakePHP < 1.2 suggests putting themes in /webroot/theme/themeName, while cakePHP > 1.3 suggests putting it in /views/themed/themeName
+ //so I'm covering both cases here
+ $themePaths = array( WWW_ROOT . 'theme' . DS . $this->theme . DS,
+ VIEWS . 'themed' . DS . $this->theme . DS,
+ );
+
+ $paths = array_merge($paths, $themePaths);
+ }
+
if (!empty($asset['plugin']) > 0) {
$pluginPaths = App::path('plugins');
Something went wrong with that request. Please try again.