0

I have some web pages generated from bootstrap studio, which display properly.

One page has a form with a submit button. On my server, php processes the form values and then needs to serve a new web page. I can get it to serve the page, but a server path is wrong and the css files don't load.

My php files are one level down in a directory called 'php'. The html files are at the top level.

I tried

chdir ('../');
require 'contact.html';

And this will display the page, but without the css formatting.

I think I need to set some server environment path, but am not sure which or how.

EDIT: the links to fetch style sheets look like this:

<link rel="stylesheet" href="assets/css/styles.css">
Peri Hartman
  • 19,314
  • 18
  • 55
  • 101

1 Answers1

0

You can get the HTML with a file get contents:

$html = file_get_contents($the_html_file_path.html);

and replace the path to an absolute path like:

$html = str_replace('"assets/','"/assets/',$html);

and you have your html with the absolute path.

portapipe
  • 26
  • 5