newbtophp Posted August 28, 2009 Share Posted August 28, 2009 I have a variable: $rootpath = $_SERVER["SCRIPT_FILENAME"]; include '$rootpath/templates/header.php'; How would i place the variable in the include?, the way im doing it, is currently giving me errors. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/172220-variable-in-include/ Share on other sites More sharing options...
trq Posted August 28, 2009 Share Posted August 28, 2009 Variables are not interpolated within single quotes. So... include "$rootpath/templates/header.php"; or.... include $rootpath . '/templates/header.php'; Quote Link to comment https://forums.phpfreaks.com/topic/172220-variable-in-include/#findComment-908024 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.