Yii Framework Forum: How about THEME management? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How about THEME management?

#1 User is offline   imehesz 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 703
  • Joined: 13-June 09
  • Location:Jacksonville, FL

Posted 24 January 2012 - 05:08 PM

Hello Yii Team,

I didn't see any information about theme management here. Is it gonna change at all, or we can keep using Yii 1.x themes?


thanks,
--iM
It’s done, the great act of creation.
The maker rests. The wheel’s in motion.
-- Imre Madách

check out Yii Theme Factory at http://yii.themefactory.net
0

#2 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,428
  • Joined: 17-January 09
  • Location:Russia

Posted 25 January 2012 - 09:48 AM

Any ideas on what should be different?
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
0

#3 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 566
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 25 January 2012 - 04:24 PM

Themes should be available via the package manager, therefore you'd be able to adjust the theme directory to a non-public location or provide another solution.

Also a possibility to theme widgets would be cool.
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#4 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,651
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 25 January 2012 - 04:40 PM

I haven't yet read all 2.0 discussions so this may already have been addressed. I think we need better integration of Yii themes => CWidgetFactory => widget skins & JUI themes.
Don't forget to read The Definitive Guide to Yii (en) (sv) | The class reference has the details
0

#5 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 566
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 25 January 2012 - 04:46 PM

View Posttri, on 25 January 2012 - 04:40 PM, said:

I haven't yet read all 2.0 discussions so this may already have been addressed. I think we need better integration of Yii themes => CWidgetFactory => widget skins & JUI themes.

as a cross-reference: http://www.yiiframew...post__p__108123
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#6 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 566
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 09 April 2013 - 06:26 AM

As an idea, what could be improved about theme management, please have a look at my multi-theme extension.

While it's not perfect, it enhances to flexibility of theme usage in Yii 1.x. Basically you can pre-select a theme by a reg-ex on a controller route.
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#7 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,879
  • Joined: 04-October 08
  • Location:DC, USA

Posted 09 April 2013 - 06:53 AM

Theming feature is done. It's simplified with enhancements.
  • The skin feature is dropped
  • WidgetFactory is dropped and replaced with global configuration of all classes (i.e., widgets and other non-widget classes can be globally configured like in 1.1)
  • Theming is now done by replacing path prefixes. This allows theming both view names and view files. For example, if "/home/qiang/test.php" needs to be themed, and the theme has a path map "/home/qiang" => "/home/schmunk", then the themed version would be "/home/schmunk/test.php".

I looked at your multi-theme extension. It may be useful in a setup that mixes backend and frontend. In a setup like described below, this is not needed: http://www.yiiframew...ii-project-site
0

#8 User is offline   Psih 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 114
  • Joined: 30-June 10

Posted 09 April 2013 - 07:05 AM

Recently I have found kind'a creative use for themes, we use a theme as a website packing all the js, css and image resources into a theme and pusblishing it. We also use a directory in controllers dir named the same as the theme and are setting controller path like controllers/theme_name based on theme set in configuration.
Personally I would like this functionality expanded a little. Also to make full use of this functionality, I want the ability to set multiple directories for controllers :)

But this probably is an edge case, so you can ignore it :)
0

#9 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 09 April 2013 - 07:15 AM

I always use themes to work around having to publish css and js because I am handling that myself. :)
"Less noise - more signal"
0

#10 User is offline   schmunk 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 566
  • Joined: 02-November 08
  • Location:Stuttgart, Germany

Posted 09 April 2013 - 09:05 AM

@Qiang: My use case is the following: I include a module (eg. yii-user) via composer and I have to change the theme for that module, because - let's say my default (frontend) theme has been completely changed, but I don't want to change the code in the module itself.

Can I overwrite the theme for that module - partially for some controller actions or even views - with the global configuration?
Or do I have to stick with something like the current theme manager replacement?
Phundament - Yii Application Boilerplate with composer support
Fork on github

Follow phundament on Twitter

DevSystem: Mac OS X 10.7 - PHP 5.3 - Apache2 - Yii 1.1 / trunk - Firefox or Safari
0

#11 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,879
  • Joined: 04-October 08
  • Location:DC, USA

Posted 09 April 2013 - 09:40 AM

Because the new theme implementation is based on path mapping, you may theme whatever files, provided you know the source file paths.
For your particular example, you could add a path map like: '@yii-user/views' => '@webroot/themes/mytheme/yii-user', and you can then customize the view files and resource files for the module.
1

#12 User is offline   Onman 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 175
  • Joined: 26-December 09
  • Location:The Netherlands

Posted 10 April 2013 - 02:05 AM

I have always (slightly) ajusted the theme directory: my theme directory contains the public files and directories (like it does now) but also a 'protected' directory which contains a directory 'views' (speaks for itself) and a directory 'widgets' which contains the theme-specific widgets.

Use case:
My default view files contain, for example, a widget @widgets.CBreadcrumbs. What my custom Controller does is first look in <theme>.protected.widgets if the widget exists. If it does that's the widget that's used. If it does not exist, it looks for the widget in the webroot.protected.widgets (i.e. <theme> is replaced by 'webroot') and uses the widget found there.
I guess its clear that the default CBreadcrumb contains all the functionality required but uses a different representation from that of, say, Bootstrap. This way I don't need to create a theme specific viewfile just to include a widget with a similar API but different representation.
I'm not quite sure if this results in the same functionality as the yii2 path mapping.

In addition to this my <theme>/protected directory also may contain a class file Theme (class Theme extends CTheme). If this theme-specific Theme class exists it is used by the themeManager to represent this theme. I mainly use this feature to set a (user specific) color which is used to compile the less files into css files and sometimes to configure portlet containers.

Finally I define the path alias 'theme' when a theme is set. Obviously it points the the /themes/myTheme path.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users