ds111 Posted January 5, 2008 Share Posted January 5, 2008 Hi guys! great forum! ok well i need help with this i've tried google and everything. this is what i have: i have a template.php where the heading and body are dynamic (this is a css template) so basically i have the html and everthing and where the heading or content usually is, i put <php echo $heading; ?> and same for body. now for login.php, this is what i have. $heading = 'Login'; <-- works $body = "include 'login_form.php';"; <--- doesn't work include 'template.php'; <---works so how do i do an include statement in a variable? thanks for any answers! Quote Link to comment https://forums.phpfreaks.com/topic/84650-include-in-php-variable/ Share on other sites More sharing options...
marhoons Posted January 5, 2008 Share Posted January 5, 2008 $body = include("login_form.php"); but the out put will be define in $body variable! Quote Link to comment https://forums.phpfreaks.com/topic/84650-include-in-php-variable/#findComment-431392 Share on other sites More sharing options...
papaface Posted January 5, 2008 Share Posted January 5, 2008 Try: $body = include("login_form.php"); Oh well, to slow lol. Quote Link to comment https://forums.phpfreaks.com/topic/84650-include-in-php-variable/#findComment-431393 Share on other sites More sharing options...
toplay Posted January 5, 2008 Share Posted January 5, 2008 $script = 'script_filename.php'; include($script); Quote Link to comment https://forums.phpfreaks.com/topic/84650-include-in-php-variable/#findComment-431394 Share on other sites More sharing options...
ds111 Posted January 5, 2008 Author Share Posted January 5, 2008 it not working. here is screenshot: it shows '1' for some reason. and shows the login form in header. why? Quote Link to comment https://forums.phpfreaks.com/topic/84650-include-in-php-variable/#findComment-431408 Share on other sites More sharing options...
ds111 Posted January 5, 2008 Author Share Posted January 5, 2008 anyone? plz? Quote Link to comment https://forums.phpfreaks.com/topic/84650-include-in-php-variable/#findComment-431419 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.