Spring Posted October 21, 2010 Share Posted October 21, 2010 Okay so we all know <?php include "theme.html"; print: "Hello"; ?> Would output the theme and output hello at the bottom of the page, my question is, how do you position hello to go on the current theme? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/216451-including-a-overall-theme/ Share on other sites More sharing options...
phprocker Posted October 21, 2010 Share Posted October 21, 2010 Split your html into a header and footer. Try this. themeheader.php <html> <head></head> <body> themefooter.php </body> </html> index.php <?php // include header include 'themeheader.php'; //echo statement echo "Hello"; //include footer include 'themefooter.php'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/216451-including-a-overall-theme/#findComment-1124761 Share on other sites More sharing options...
Spring Posted October 21, 2010 Author Share Posted October 21, 2010 Split your html into a header and footer. Try this. themeheader.php <html> <head></head> <body> themefooter.php </body> </html> index.php <?php // include header include 'themeheader.php'; //echo statement echo "Hello"; //include footer include 'themefooter.php'; ?> Oh that sort of fixes my problem, but say I want "hello" in a fixed position, like underneath a form, would I still go about doing it the same way? Quote Link to comment https://forums.phpfreaks.com/topic/216451-including-a-overall-theme/#findComment-1124764 Share on other sites More sharing options...
Spring Posted October 21, 2010 Author Share Posted October 21, 2010 Actually, I followed your example and I actually think I know what to do now, thanks alot! Quote Link to comment https://forums.phpfreaks.com/topic/216451-including-a-overall-theme/#findComment-1124767 Share on other sites More sharing options...
phprocker Posted October 21, 2010 Share Posted October 21, 2010 Yes, this is one way. Another is to declare the variables you want to echo and then include your "view". Like this: theme.php <html> <head></head> <body> <form> </form> <?php echo $hellovar; ?> </body> </html> index.php <?php $hellovar = "Hello"; include 'theme.php'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/216451-including-a-overall-theme/#findComment-1124768 Share on other sites More sharing options...
Spring Posted October 21, 2010 Author Share Posted October 21, 2010 Yes, this is one way. Another is to declare the variables you want to echo and then include your "view". Like this: theme.php <html> <head></head> <body> <form> </form> <?php echo $hellovar; ?> </body> </html> index.php <?php $hellovar = "Hello"; include 'theme.php'; ?> Dude, I love you. It worked! Quote Link to comment https://forums.phpfreaks.com/topic/216451-including-a-overall-theme/#findComment-1124770 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.