Jump to content

[solved] alternative view on site


biber
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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

 

 

  • Like 4
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...