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.

Strange behaviour with {site_url} variable

July 12, 2011 4:24pm

Subscribe [2]
  • #1 / Jul 12, 2011 4:24pm

    pantasarus

    28 posts

    Hi,

    I’m currently using EE 2.2.1 with MSM 2.1.0 and I’m having a problem with the {site_url} variable.

    If it’s in a webpage template, it gets rendered as “http://mysite.com/”. If it’s in a css template, it gets rendered as “http://mysite.com” ie no trailing slash.

    I tried it on a test install without MSM and this time it rendered as “http://mysite.com/” both times. Obviously I can work around this but I was curious as to whether it was expected behaviour or not.

    Thanks

    P

  • #2 / Jul 13, 2011 1:48pm

    Sue Crocker

    26054 posts

    Hi, pantasarus.

    I did the following in a template:

    body {
            background-color: pink;
            font-family: Verdana, Ariel, sans-serif;
            font-size: 11px;
            background: url({site_url}abc.jpg);
    }

    and got back the following when viewing the source:

    body {
            background-color: pink;
            font-family: Verdana, Ariel, sans-serif;
            font-size: 11px;
            background: url(<a href="http://localhost/tip2/abc.jpg">http://localhost/tip2/abc.jpg</a>);
    }

    in other words, I can’t replicate the problem. Are you on the first site or a second site when testing this?

  • #3 / Jul 13, 2011 2:42pm

    pantasarus

    28 posts

    Hi,

    This happens on the third site. The other two just use flat files for their css. The third one has the css stored as templates and saved as files, if that helps.

    P

  • #4 / Jul 14, 2011 10:49pm

    Lisa Wess

    20502 posts

    Hi, pantasaurus -

    Are you testing this in totally reduced templates?

    ie: make a blank css template and put just {site_url} in there.  same with a web page type template.  then view those in your browser and view source, do you still get the different results?

    So the entire template contents should be one line:

    {site_url}

    Thanks!

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

ExpressionEngine News!

#eecms, #events, #releases