Jump to content
thirty bees forum
  • 0

Generating absolute url for BO


Question

Posted

I wondered, how it's possible to generate absolute urls for the backoffice? I know ofc, that I could hardcode this, but what would be the correct way of doing it?

The goal is something like: https://www.domain.com/admin2389/index.php?controller=AdminDashboard (basically the "admin2389" part is unclear to me)

I need this to take actions from a link in an email, that was sent to the admin. Is there any risk invovled @datakick?

 

2 answers to this question

Recommended Posts

  • 0
Posted

Oh I just found a function called "basename()". Never heard of it before. With that it's pretty straightforward:

$link->getBaseLink().basename(_PS_ADMIN_DIR_).'/'.$link->getAdminLink('AdminDashboard', false)

 

  • Like 1
  • 0
Posted

Yep, this would work for simple urls without any parameters.

For urls with parameters (https://www.domain.com/admin2389/index.php?controller=AdminDashboard&param1=something&param2=other&token=tokenvalue) you would have to include token into the url. Tokens are employee specific, so you would have to know upfront which employee will be opening this url.  

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...