we recently decided to upgrade our website (more like upgrading the static old pages to the dynamic content). So, we have like 500 old html pages which we need to integrate using php.
The template with headers , footers , etc using php includes is working but the problem arises when i try to include the html file.
Before including the html I use include path with set_ini to declare the include path for html as "./fo1/boo2/" (Using the dot in the beginning to tell the system that it is relative to the root directory).
Then I used include ($thehtmlfile); which worked. The html file was included, however, the problem arises when the html file itself links to images,these image files are actually in a separate subdirectory like this "./fo1/boo2/images/" .
Instead, the html file tries to find the images folder in the root directory!!!! I have tried using chdir but it doesn't work.
I used get file contents and another method to get the content of the whole html file and then i used stringreplace to replace the href=images text within the html with the path + images text as the href. It worked but it is infact a nightmare for the server!. Parsing every file and replacing strings thats just killing the server and since we have shared hosting from a hosting provider I think they can take my website offline if this amount of activity continues!
So there is no way around using php include or even server side includes. Can any one pleaseee help me out with the code, is there some correction, alteration,deletion and addition I must make?