VuFind

Change Template Links to include theme variable

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Trivial Trivial
  • Resolution: Won't Fix
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: User Interface
  • Labels:
    None
  • Environment:
    All

Description

At present, the css / smarty templates are assigned using the theme variable in config.ini but the theme directory has to be harcoded into the css template:

background-image:url(<?php echo $configArray['Site']['path'];?>/interface/themes/default/images/author_bg.jpg);

If the theme variable was used instead: - background-image:url(<?php echo $configArray['Site']['path'];?>/interface/themes/<?php echo $configArray['Site']['theme'];?>/images/author_bg.jpg); - no changes to the styles.css file would be needed. This would also create the opportunity for changing style sheets "on the fly". A user could select a different theme which could be stored in their account settings as a default theme or in a session field which could be used for the duration of that session or for particular IP addresses.

E.g.
if ($user['theme']) { // use user selected theme }
else if ($_SESSION['theme']) { // Use Session Theme }
else { // use theme specified in config.ini }

Issue Links

Activity

Hide
Demian Katz added a comment -
The problem with including the 'theme' setting in the URL is that it may include multiple theme names when theme inheritance is used (see http://vufind.org/wiki/customization#theme_inheritance ). Perhaps the CSS files need some sort of shared utility function that can be used to search the theme inheritance path (and any user or session based overrides) for an image. However, this would be moving away from the idea of making the CSS files more static.

An approach that might work with more static CSS files yet allow CSS switching would be to define custom themes that inherit from a base theme. Each of these child themes would just include a CSS file that @imports the styles.css file from the parent theme and then override images and other styles as needed. All paths could be relative, and things would still work out.
Show
Demian Katz added a comment - The problem with including the 'theme' setting in the URL is that it may include multiple theme names when theme inheritance is used (see http://vufind.org/wiki/customization#theme_inheritance ). Perhaps the CSS files need some sort of shared utility function that can be used to search the theme inheritance path (and any user or session based overrides) for an image. However, this would be moving away from the idea of making the CSS files more static. An approach that might work with more static CSS files yet allow CSS switching would be to define custom themes that inherit from a base theme. Each of these child themes would just include a CSS file that @imports the styles.css file from the parent theme and then override images and other styles as needed. All paths could be relative, and things would still work out.
Hide
Demian Katz added a comment -
Since VuFind 2 is going to be based on the Blueprint theme, which uses relative image paths rather than PHP-injected absolute paths inside the CSS, this issue is no longer exactly relevant. VuFind 2 allows a theme to inherit from its parent but also add an additional CSS file; this provides a fairly straightforward mechanism for overriding individual graphics on a theme-by-theme basis.

Admittedly, this isn't completely ideal -- it might be better if the CSS could search through the theme inheritance chain and pick the most appropriate graphic -- but in the interest of avoiding dynamic CSS generation, I think it's okay as it is. If this becomes a real problem for anyone, or if someone comes up with a better solution, please open a new ticket.

In the meantime, I've gotten Luke's permission to close this ticket.
Show
Demian Katz added a comment - Since VuFind 2 is going to be based on the Blueprint theme, which uses relative image paths rather than PHP-injected absolute paths inside the CSS, this issue is no longer exactly relevant. VuFind 2 allows a theme to inherit from its parent but also add an additional CSS file; this provides a fairly straightforward mechanism for overriding individual graphics on a theme-by-theme basis. Admittedly, this isn't completely ideal -- it might be better if the CSS could search through the theme inheritance chain and pick the most appropriate graphic -- but in the interest of avoiding dynamic CSS generation, I think it's okay as it is. If this becomes a real problem for anyone, or if someone comes up with a better solution, please open a new ticket. In the meantime, I've gotten Luke's permission to close this ticket.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: