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.

MSM & base site_url

December 27, 2012 5:44pm

Subscribe [2]
  • #1 / Dec 27, 2012 5:44pm

    adlur

    104 posts

    I am setting up multiple sites using MSM. I have a default site, and all my assets (css. js, etc) are located in this site’s directory. Typically I will add JS and CSS files to a snippet, for example

    < script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js">< /script >
    < script src="{site_url}scripts/slideShow5.js">< /script >
    < script src="{site_url}scripts/autoadvance.js">< /script >
    < script src="{site_url}scripts/toggleText.js">< /script >
    < script src="{site_url}scripts/bannerSlider.js">< /script >

    However, {site_url} becomes the current site’s URL: I need it to be the default site’s URL.

    I’ve also tried using an embedded template that I created in my default site:

    {embed='default_site:global_embed/.scripts'}

    which shows the embedded template’s contents, but also replaces site_url with the current site’s URL.

    Do I have to hard-code the URL anywhere I’m using assets from the default site?

  • #2 / Dec 28, 2012 3:59pm

    Kevin Cupp

    791 posts

    I think the usual solution for this is to set MSM site URLs in global variables. That may be easier to maintain dynamically if you set them in your index.php as this comment suggests: http://ellislab.com/expressionengine/user-guide/templates/globals/user_defined.html#9358

  • #3 / Dec 28, 2012 5:37pm

    adlur

    104 posts

    Thanks Kevin, I’ll give it a go-

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

ExpressionEngine News!

#eecms, #events, #releases