Created
February 25, 2016 10:37
-
-
Save MatthieuScarset/d7860328118136ab143c to your computer and use it in GitHub Desktop.
Drupal - Go to error page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Redirect to error page | |
* @param $site string Wether is for mobile or desktop site | |
* @param $err_code int Error code | |
* @param $path bool|string Force a path for redirection | |
* @see http://www.kobashicomputing.com/creating-custom-drupal-6-error-pages | |
* @return header() | |
*/ | |
function _goto_error_page($site = 'mobile', $err_code = 404, $path = false) { | |
$variable_name = ($site == 'mobile') ? "site_mobile_$err_code" : "site_$err_code"; | |
$location = $path ? $path : drupal_get_normal_path(variable_get($variable_name, $path)); | |
header('Location: /' . $location); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment