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.

Linking to a stylesheet from multiple sites using MSM

October 13, 2010 8:37pm

Subscribe [5]
  • #1 / Oct 13, 2010 8:37pm

    Sean O'Brien

    78 posts

    I use a single CSS file to style multiple websites through MSM. Has a way been created to link between MSM sites using EE code? I imagine it would look something like this:

    {stylesheet=site:channel/channel_css}

    So far the cleanest way to do this seems to be hard-coding the path to the stylesheet while leaving off the .css, like this:

    <a href="http://my_website.com/my_stylesheet">http://my_website.com/my_stylesheet</a>

    Is there a better way to do this in EE yet without running the CSS through the EE template parser?

  • #2 / Oct 14, 2010 3:54am

    John Henry Donovan

    12339 posts

    Sean,

    If it is one stylesheet for all sites I generally would just go the old fashioned route. There is no need to use a tag unless I am missing something in your set-up?

    <link rel=‘stylesheet’ type=‘text/css’ media=‘screen,projection’ href=‘http://my_website.com/inc/my_stylesheet.css’ />

  • #3 / Oct 14, 2010 12:52pm

    Sean O'Brien

    78 posts

    Hi John,

    I have been putting the stylesheet in a “_globals” folder in my main site so that I could take advantage of EE’s version control and so it will show up in the CP. It looks like my use of EE’s standard path to the template location leads to a file without the .css suffix In order to continue using this set-up, I just remove the .css from the path in my header. The only negative consequence I’m aware of is that I can’t add an expires header to the css file from the .htaccess - so this doesn’t work:

    ExpiresByType text/css "access plus 1 month"

    An alternative would be to link to the actual location on my server of the CSS file, but that would alert visitors to the name of my system folder, and according to the User Guide, that’s not something I should do. Or, as I think your code suggests, I could place the CSS file in an assets folder in the root directory, but then I would lose version control and access to the CSS file through the CP.

    This is a rather minor issue, but it would be nice to have a path that worked with MSM.

  • #4 / Oct 14, 2010 4:32pm

    Ingmar

    29245 posts

    I am afraid using a hardcoded URL (perhaps put in a global variable, or a snippet) would be the way to go here. Consider making a Feature Request, too.

  • #5 / Nov 09, 2010 7:05pm

    Consider making a Feature Request, too.

    Done and done.

  • #6 / Nov 09, 2010 7:42pm

    Sean O'Brien

    78 posts

    Thanks.

  • #7 / Nov 10, 2010 10:00am

    Sue Crocker

    26054 posts

    Sean, sounds like you have a possible workaround. Don’t hesitate to post again as needed.

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

ExpressionEngine News!

#eecms, #events, #releases