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.

stylesheet global variable issue

July 23, 2010 12:49pm

Subscribe [4]
  • #1 / Jul 23, 2010 12:49pm

    insiteadvice

    68 posts

    I have a snippet called css that contains the following:

    <link rel="stylesheet" type="text/css" media="all" href="{stylesheet=stylesheets/style.css}" />

    The template type is set to CSS. The rendered template has this in the head:

    <link rel="stylesheet" type="text/css" media="all" href="http://closetinabox.insiteadvice.com/index.php?css=stylesheets/style.css">

    The CSS isn’t taking effect. I tried visiting the URL in the link tag from the rendered template, and it does not display the CSS.

  • #2 / Jul 23, 2010 3:34pm

    Sue Crocker

    26054 posts

    See the style.css? You should have a snippet like this:

    <!-- CSS -->
    <!-- This makes use of the stylesheet= parameter, which automatically appends a time stamp to allow for the browser's caching mechanism to cache the stylesheet.  This allows for faster page-loads times.
    Stylesheet linking is documented at <a href="http://ellislab.com/expressionengine/user-guide/templates/globals/stylesheet.html">http://ellislab.com/expressionengine/user-guide/templates/globals/stylesheet.html</a> -->
        <link href="{stylesheet=global_embeds/site_css}" type="text/css" rel="stylesheet" media="screen" />
  • #3 / Jul 23, 2010 3:44pm

    insiteadvice

    68 posts

    does the template group have to be called global_embeds? and the stylesheet has to be called site_css?

    not that it really matters, just seems strange and inconsistent with what the docs say.

  • #4 / Jul 23, 2010 5:53pm

    Brandon Jones

    5500 posts

    curtisblackwell,

    No, you can name the template group and template anything you’d like. Try Synchronizing your templates.

  • #5 / Jul 23, 2010 6:01pm

    insiteadvice

    68 posts

    I had already tried that and clearing cache (both through the backend and manually). I’ll just stick with the global_embeds; I don’t really have time to mess with it now.

    Thanks for the help.

  • #6 / Jul 23, 2010 7:15pm

    Brandon Jones

    5500 posts

    For reference, if you’re saving templates as files and haven’t synchronized templates (specifically your CSS files) EE won’t be able to determine the stylesheet version (which usually appears as ?v=... after the css filename)

    So make sure the CSS template appears in the template manager, is set to the CSS type, and that you’ve visited the Synchronize Templates page and pressed Submit at the bottom.

    Glad you have a solution for now but let us know if you need further assistance.

  • #7 / May 16, 2011 2:48pm

    Etheya

    213 posts

    Just trying using this for a change rather than moving the CSS files externally as i normally do… one thing im not sure about is when your used to calling say main.css then you have a rule within that such as

    @import url(layout.css); /* LAYOUT CSS */

    How do you handle that in this way?

    SO for example i have

    <link rel="stylesheet" type="text/css" media="screen" href="{stylesheet=global_embeds/main}" />

    But that css sheet has normally an @import line of code… cant seem to get it to find it at present

  • #8 / May 16, 2011 2:56pm

    Etheya

    213 posts

    Forget last… figured it out..

    @import url("/global_embeds/layout");
  • #9 / May 16, 2011 3:27pm

    Kevin Smith

    4784 posts

    Does this take care of it for you, Etheya?

    Kevin

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

ExpressionEngine News!

#eecms, #events, #releases