Giter Site home page Giter Site logo

cozumel424 / yii2-themepicker Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 5 KB

This is a simple extension to pick themes. The user chooses a theme from a dropdown box and the theme choice is stored in a cookie, the extension could easily be changed to work with a model too.

PHP 100.00%

yii2-themepicker's People

Contributors

cozumel424 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

yii2-themepicker's Issues

Can't modify the path for the theme css file

Your Themepicker extension seems to be an excellent resource. However, I am having difficulty set $themePath in a variation of the advanced template. Specifically, my directory structure looks like this:

-- yii2  (base application directory)
    -- _protected
        -- backend (what would normally be the backend in the advanced template)
        -- common
        -- console
        -- environments
        -- frontend
        -- tests
        -- vendor
    -- assets
    ...
    -- themes (where the actual theme directories reside)

I have tried multiple ways to define the $themePath variable so that it works and have gotten there, sort of. I can easily get the dropdown to correctly display all my themes by doing this:

Yii::setAlias('themes', realpath(dirname(__FILE__).'/../../../themes')); (in _protected/common/config/bootstrap.php

$themePath = \Yii::getAlias('themes'); (in ThemePicker.php, although I hate channging the source code for an extension)

However, when I try to switch themes, it falls apart because the css file that is handed off has a bizarre path in it. Specifically, the path is:

<link href="L:\xampp\htdocs\yii2\_protected\frontend/themes/almost-victorian/css/site.css" rel="stylesheet">

The path should be:

<link href="L:\xampp\htdocs\yii2\themes/almost-victorian/files/main_style.css" rel="stylesheet">

I'm also using themes from ThemeFactory.net which has the <THEME_NAME/files/main_style.css way of storing the theme.

I've tried in vain to find out where that actual, bizarre path is coming from and how to reset it. I'm not sure if it's coming from your extension or elsewhere.

Can you give me any help on this?

Actually, I just answered my own question. I modified the Themepicker bootstrap.php file to read:

          'pathMap' => [
                //'@app/views' => '@app/themes/' .$themeName ,
                '@app/views' => \Yii::getAlias('themes') . '/' . $themeName,
                '@app/modules' => '@app/themes/' .$themeName . '/modules',

            ],

            //'baseUrl' => '@app/themes/' .$themeName
            'baseUrl' => '/' . \Yii::getAlias('themes') . '/' . $themeName,

You might want to consider including this in your somewhat scanty instructions. I took me quite a while to figure it all out.

Now I have two additional issues.

First, when attempting to switch themes, I have to choose the same theme from the dropdown TWICE before it will actually change. Selecting it just once does nothing.

Second, there don't seem to be any hooks for styling the widget. I'd like to include in my topnav navbar, but that requires adding some very specific classes and such to the select. Do you have any suggestions?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.