Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting a theme doesn't work correctly #12

Open
loopdream opened this issue Jan 8, 2013 · 5 comments
Open

Setting a theme doesn't work correctly #12

loopdream opened this issue Jan 8, 2013 · 5 comments

Comments

@loopdream
Copy link

I have created 2 themes - default and admin.
the following code doesn't output the admin theme:

$this->twiggy->theme('admin'); // load theme
echo $this->twiggy->get_theme(); // this returns 'admin' - which is correct
$this->twiggy->display(); // outputs default theme not admin - incorrect

@loopdream
Copy link
Author

FYI - I uncommented line 457 in the Twiggy lib - method _set_template_locations. Functionality now works.

// Reset template locations array since we loaded a different theme
$this->_template_locations = array(); // UNCOMMENTED THIS LINE

@edmundask
Copy link
Owner

Thank you for your feedback. I'll look into this when I have the time.

@lewispb
Copy link

lewispb commented Mar 22, 2013

This was the solution for me, I changed lines ~478 :

    $this->_template_locations[] =  $this->_themes_base_dir . $theme;
    $this->_template_locations = array_reverse($this->_template_locations);

@veljamatic
Copy link

even though i dont see a need to set(change) theme multiple times, reversing the array is a bad idea.

array_unshift($this->_template_locations, $this->_themes_base_dir . $theme);
//$this->_template_locations[] =  $this->_themes_base_dir . $theme;

and maybe add array_unique() to the mix

@alexhermida
Copy link

@lewispb thanks for the solution. @veljamatic I would like to know why do you think that isn't a good idea?

In my case I also need more than one theme because I have different themes for the public site and private/admin site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants