biber Posted October 5, 2016 Posted October 5, 2016 Hi, I've built a site for my wife (malabu.de), which is already published. But there are still some things i want to work on. For not disturbing regular guests I would like to have a subdomain like dev.malabu. de which leads me to the same site, but with my own (experimental) CSS. Is there a way to do this?
blynx Posted October 5, 2016 Posted October 5, 2016 Hej, you will get the current hostname via $config->httpHost if($config->httpHost === "dev.malabu.de") { echo "<link rel='stylesheet' href='dev.css'>"; } else { echo "<link rel='stylesheet' href='style.css'>"; } another approach could be to check if the visitor is superuser or has a dev role (add a "dev" role before) and assign it to your dev account – and then, similar to above: (you don't have to setup subdomains then ...) <?php if($user->hasRole("superuser")) { ... } else { ... } ?> <link rel='stylesheet' href='url/to/css/<?= ($user->hasRole("superuser")) ? "dev.css" : "normal.css" ) ?>'> or like in the last line with the shorthand if/else syntax 4
biber Posted October 5, 2016 Author Posted October 5, 2016 @blynx: thanks a lot, I've used your second version and it works like a charm. 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now