1

I'm trying the following code to save the latest visited url across a page reload:

TEMPLATE A:

{exp:stash:set name="latest_url" scope="site" save="yes" refresh="60"}

{exp:current_url:full_url}

{/exp:stash:set}

TEMPLATE B:

{exp:stash:latest_url}

or

{exp:stash:get name='latest_url'}

--

There's no output, whatever I do!

But the current url is successfully grabbed in template A, which I can see, after turning output to "yes".

What's wrong?

1 Answer 1

1

If you trying to make the saved url user-specific I would use scope="user", and add parse_tags="yes" and replace="yes" to the parameters. See if this works:

{exp:stash:set 
    name="latest_url" 
    scope="user" 
    save="yes" 
    replace="yes"
    parse_tags="yes"
    trim="yes"
}
    {exp:current_url:full_url}
{/exp:stash:set}

{exp:stash:get name="latest_url" scope="user"}
4
  • Awesome! Thank you so much, man. I was almost about to lose my mind about this! :)
    – tibitabo
    Apr 2, 2015 at 5:51
  • One minor problem persists though! It seems that in Chrome only "favicon.ico" gets added as the last segment of the saved url. Any ideas on how to prevent this? Thanks!
    – tibitabo
    Apr 2, 2015 at 6:00
  • OK, it seems it's also a problem in Firefox... :(
    – tibitabo
    Apr 2, 2015 at 6:22
  • Alright, I fixed it using ce_string to trim the last segment! Thanks! :)
    – tibitabo
    Apr 2, 2015 at 6:35

Your Answer

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

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