Ty44ler Posted June 4, 2009 Share Posted June 4, 2009 I am building a site that has a ton of pages, but the layout is all the same and is only changed by the directory that the php functions call. Is it possible to make a function that calls an external php file so that I only have to edit one file when making a change to the site? Quote Link to comment https://forums.phpfreaks.com/topic/160976-edit-only-one-php-file-for-a-whole-site/ Share on other sites More sharing options...
MadTechie Posted June 4, 2009 Share Posted June 4, 2009 $contents = file_get_contents("myfile.html"); //or include("myfile.html"); Quote Link to comment https://forums.phpfreaks.com/topic/160976-edit-only-one-php-file-for-a-whole-site/#findComment-849538 Share on other sites More sharing options...
Ty44ler Posted June 4, 2009 Author Share Posted June 4, 2009 Does the file that has all the editable code go into the web root? Quote Link to comment https://forums.phpfreaks.com/topic/160976-edit-only-one-php-file-for-a-whole-site/#findComment-849549 Share on other sites More sharing options...
MadTechie Posted June 4, 2009 Share Posted June 4, 2009 It doesn't matter.. Quote Link to comment https://forums.phpfreaks.com/topic/160976-edit-only-one-php-file-for-a-whole-site/#findComment-849558 Share on other sites More sharing options...
Ty44ler Posted June 4, 2009 Author Share Posted June 4, 2009 There's my error... Warning: file_get_contents(EditCode.php) [function.file-get-contents]: failed to open stream: No such file or directory in C:\xampp\htdocs\My Dropbox\Project Files\5th IBCT Brigade and Battalion HQ\index.php on line 2 Quote Link to comment https://forums.phpfreaks.com/topic/160976-edit-only-one-php-file-for-a-whole-site/#findComment-849562 Share on other sites More sharing options...
MadTechie Posted June 4, 2009 Share Posted June 4, 2009 2 things #1 you need to use quotes file_get_contents(EditCode.php); should be file_get_contents("EditCode.php"); #2 if the file contains php code your get the php code back (not the results) using include will give the php code results Quote Link to comment https://forums.phpfreaks.com/topic/160976-edit-only-one-php-file-for-a-whole-site/#findComment-849570 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.