ocetalo Posted December 18, 2008 Share Posted December 18, 2008 e.g. keeping all the <p> I use in my web site stored in a single file, then refer to any of them from the respective page, or doing something like that. I hope I make understood. Please give easy answer, I'm just learning. Thanks in advance. God bless you. Link to comment https://forums.phpfreaks.com/topic/137618-i-want-to-include-part-of-a-file-not-the-whole-file-using-php-include/ Share on other sites More sharing options...
ILMV Posted December 19, 2008 Share Posted December 19, 2008 The only way you could do it, is to set a variable then include like this... $page=about; include './content.php' Then in your included file do this... switch($page) { case 'about': ?><p>Random paragraph</p><?php break; case 'contact: ?><p>Contact Me</p><?php break; } Something like that should work. ILMV Link to comment https://forums.phpfreaks.com/topic/137618-i-want-to-include-part-of-a-file-not-the-whole-file-using-php-include/#findComment-719319 Share on other sites More sharing options...
ILMV Posted December 19, 2008 Share Posted December 19, 2008 Edit: $page='about'; // quote marks case 'contact': // quote marks - Its past midnight in the UK, half asleep Link to comment https://forums.phpfreaks.com/topic/137618-i-want-to-include-part-of-a-file-not-the-whole-file-using-php-include/#findComment-719320 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.