Home > Mobile >  If I rename an index.html to index.php, the CSS style disappears
If I rename an index.html to index.php, the CSS style disappears

Time:11-17

Yesterday I discovered a website called Too Plate:

https://www.tooplate.com/about

It has free HTML templates, and all they are very beautiful. I had the idea to turn the theme that I chose to PHP, so, I just renamed the file index.html to: index.php But, when I open it using a brwser, all the style is gone... As if the template could not find the CSS file... But I just renamed the file, I did'nt change anything inside the code (I only added the "" tags a the beginning...) This is the template:

https://www.tooplate.com/view/2122-nano-folio

How can I fix this, please?

CodePudding user response:

you must need to run the code in server eg: local servr xampp or wampp then only your php code work try this

CodePudding user response:

Once you add the PHP extension it handles the file as a PHP script, which is a server-side language that's get executed on the server before loading the page, so to view ant PHP file you have to have a server running the PHP code, but HTML runs on any browser.

So what happened was that because you changed the extension the browser treated it as a PHP script and cant Execute the script because it's not a server.

CodePudding user response:

https://felbdogg.com/test2/index.php

code works fine... I'm not sure what you changed but I uploaded it to my server and works the same as what I downloaded.

If your opening it on your computer without a server it will not load. XAMPP is free and works great for testing.

  • Related