0

I have the following code using the {site_url} variable, like so:

<div class="g-plusone" data-annotation="inline" data-width="300" data-href="{site_url}">

However, when I changed the variable to {current_url}, it doesn't work.

<div class="g-plusone" data-annotation="inline" data-width="300" data-href="{current_url}">

Any idea why one standard global variable would work and not the other?

Thanks!

2
  • What version of EE are you using? I think current_url is a fairly new global variable. I think it was introduced in 2.5.5
    – foamcow
    May 22, 2013 at 22:43
  • Turns out we're using 2.5.2. Should have caught that when reading the documentation. :/
    – Yazmin
    May 24, 2013 at 0:55

1 Answer 1

0

{current_url} was only included in EE 2.5.4 so if it's older than this then that will be why it doesn't work. An alternative approach would be to either use {site_url} followed by segment variables (not too clean) or use one of the many plugins which address this shortfall prior to 2.5.4.

Personally I quite like URL Helper as it has many useful utilities wrapped up into one handy package. It fills a lot of small holes in EE's URL handling.

1
  • Thanks Ian. We're using 2.5.2 which explains the problem. I'll use segments for now until they upgrade.
    – Yazmin
    May 24, 2013 at 0:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.