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? 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"); 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? 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.. 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 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 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
Archived
This topic is now archived and is closed to further replies.