Forum
Setting a region within a PHP statement
I use a mobile redirection script on my site and want to make an editable region so that the URL can be changed for each page.
I thought that this would work:
$mobileurl = perch_content('mobile-url');
if( $detect->isMobile() && !$detect->isTablet() && $_GET['fs']!=true){
header("Location: https://www.domain.com/mobile/".$mobileurl");
}
However when I visit via mobile I get the following error:
Cannot modify header information - headers already sent by.......runtime.php
Now, I can get rid of that error by using ob_start(); at the top of my page, however the redirect doesn't go to the URL specified.
What would your solution be to making the URL within the PHP statement editable in Perch? I guess what I need to know is the correct content type to make it work?
Thanks very much
This:
needs to be this:
Amazing, thank you so much Drew! :)