ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

User defined fonts. Conditionals in stylesheet?

November 05, 2011 2:09pm

Subscribe [3]
  • #1 / Nov 05, 2011 2:09pm

    onjegolders

    29 posts

    Perhaps a very novice question, even if I’ve been using EE for a couple of months now but is it possible to use ee conditionals and global variables within my stylesheet?

    Or is it simply a case of adding a class to a div based on an if statement within one of my templates?

    Basically I would like to give the user a choice of two fonts for their paragraphs. I was planning on doing it within a Low Variable but could also use a channel custom field.

    Forgive me if this question is very simple but it’s been a long day and it’s nearing its end where I am…

    Cheers

  • #2 / Nov 05, 2011 5:23pm

    glenndavisgroup

    436 posts

    You should read this it explains how that all works:

    http://ellislab.com/expressionengine/user-guide/templates/globals/stylesheet.html

    Mike

  • #3 / Nov 06, 2011 5:14am

    onjegolders

    29 posts

    Thanks Mike, so bottom line is: it can be done but best to do it differently?

    Did you get my reply on the next/previous entry thing?

    Thanks

  • #4 / Nov 07, 2011 10:00am

    Kevin Smith

    4784 posts

    Hi onjegolders,

    Thanks to Mike for the help here!

    Yes, it’s possible to use EE tags in stylesheets, but it’s best practice to avoid it if at all possible. Running stylesheets thought the EE template parser adds some additional overhead, and since there are typically better ways to accomplish what you’re looking to accomplish, it’s better to go that route.

    In your case, yes, I would just change the class of the element in your HTML rather than use EE tags in your stylesheets.

    Does that help get you pointed in the right direction?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases