andrew_biggart Posted October 26, 2010 Share Posted October 26, 2010 Is it possible to echo php inside php? Im guessing not because you are already inside php but there must be a way round my problem. What I would like to do is if the url has project = something then echo <?php require "footer.php"; ?> if not dont echo anything. What is the best way to go about doing this ? Quote Link to comment https://forums.phpfreaks.com/topic/216870-echo-php-inside-php/ Share on other sites More sharing options...
vichu.1985 Posted October 26, 2010 Share Posted October 26, 2010 Dude, I assume that footer.php has some contents and it has an echo statement itself to show the content. In this case you just need to include the footer.php based on your condition. You don't need to use echo in your main file. Quote Link to comment https://forums.phpfreaks.com/topic/216870-echo-php-inside-php/#findComment-1126605 Share on other sites More sharing options...
PFMaBiSmAd Posted October 26, 2010 Share Posted October 26, 2010 You don't echo require/include statements anyway, so echo <?php require "footer.php"; ?> doesn't make sense at any time. You just use require "footer.php"; at the point in the php code where you want to require "footer.php". If you want to conditionally do that, you put the require "footer.php"; statement inside of an if(){} conditional statement. Quote Link to comment https://forums.phpfreaks.com/topic/216870-echo-php-inside-php/#findComment-1126606 Share on other sites More sharing options...
andrew_biggart Posted October 26, 2010 Author Share Posted October 26, 2010 Hey thanks for replying guys, I realised as soon as I posted this thread what the problem was but thanks for your help. Quote Link to comment https://forums.phpfreaks.com/topic/216870-echo-php-inside-php/#findComment-1126625 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.