I use a global variable "subdomain" (set in global.php) in my server side flows that I have set up like this:
This works great and I can access it in all server side actions.
I use this (among others) for users to store their uploaded files in a seperated folder:
But now on the client side pages, how can I access this global variable?
What is the best way to store and retreive such variables?
Is there maybe a different/better way?
Well the $_SERVER variables are available on the server side, not on the client side.
You can use set value and enable output to output the value on the page.
If your page has an autorun server action, you can set a variable in the API, mark it "output" and retrieve it client-side.
I do what you're asking about with my Stripe tables. I have global variables that grab the correct pricing table based on which environment I'm viewing...
Using the {{variable}} in code mixed with the other syntax ddUser.data.user_id does not work: <img alt="image" dmx-bind:src="'/uploads/{{scTenant.data.subdomain}}/profile/'+ddUser.data.user_id+'/thumb/'+ddUser.data.photo">
With this I mean, the wappler variables from the server connect are not rendered into it's variable value:
Also don’t confuse server sessions with browser sessions. You can’t access server side sessions from the front end directly. For this you have to use php code, or output them via a server action on the page.