GetSimple Support Forum
call css via component - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Themes (http://get-simple.info/forums/forumdisplay.php?fid=10)
+--- Thread: call css via component (/showthread.php?tid=5244)



call css via component - datiswous - 2013-10-05

Is it possible to call certain css via a component in the template? I tried it quickly, but didn't seem to work.

It might be interesting if you have for example certain specific css for plugins which would work with multiple themes. then you just set the component code in every theme and then you can just change only the component, knowing it will change css for every theme.

Ok this might be a crazy idea...


RE: call css via component - shawn_a - 2013-10-05

You can using jquery if includes in your template, or plain javascript but its a bit harder.

$('#elementID').addClass(''classname);


RE: call css via component - Carlos - 2013-10-05

(2013-10-05, 08:02:55)datiswous Wrote: Is it possible to call certain css via a component in the template? I tried it quickly, but didn't seem to work.

Where would be those css files? Or would styles be directly editable in the component?


RE: call css via component - Carlos - 2013-10-05

Code:
<style type="text/css">

/* ... common styles, if any ... */

<?php
global $TEMPLATE;
switch($TEMPLATE) {
  case 'Innovation': ?>

/* ... styles for innov. ... */

<?php break;
  case 'Cardinal': ?>

/* ... styles for cardinal ... */

<?php break;
  case 'GSkeleton': ?>

/* ... styles for gskelet. ... */

<?php break;
  default: ?>

/* ... default styles ... */

<?php } ?>

</style>



RE: call css via component - shawn_a - 2013-10-06

Oh include css, yeah there needs to be a location to put theme outside the theme i would imagine.
I have done this via components, you insert the style tags, although you really should not put them in the middle of a document.

You are better off just always including the css, and having your selectors properly setup.