Link to home
Start Free TrialLog in
Avatar of CrisThompsonUK
CrisThompsonUKFlag for United Kingdom of Great Britain and Northern Ireland

asked on

How can I get a PHP CMS page to create an HTML file and save it to the UNIX server?

Hi.
I am designing a website for performers, using PHP and MySQL.

I need the CMS (which I am building) to be able to delete/ edit and add performers.  No problem, but the way I would usually do this is so that the performers web page would look something like this:

www.thiswebsite.co.uk/performer.php?id=22
or
www.thiswebsite.co.uk/performer.php?id=Mr Big Top

But I really need the URL to be

www.thiswebsite.co.uk/performer/Mr Big Top.html and for the file to exist...

I know I can pass HTML through the PHP compiler, so I can execute PHP in HTML, but, and HERE'S THE QUESTION:

How can I get a PHP CMS page to create an HTML file based on a template, and save it to the UNIX server so it can be accessed?

 
ASKER CERTIFIED SOLUTION
Avatar of glcummins
glcummins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of richswyatt
richswyatt

Read the file with fopen() then fread() to get the contents of the template...
Parse through it and insert the data where needed.

fwrite the contents to a file. If you need to create folders through the CMS then you'll need to use execute() to execute a "mkdir" command (provided that the user running the Apache service has rights to execute command line...
Avatar of CrisThompsonUK

ASKER

glcummins

I see you are a master..  I am humbled.

The reason for all lthis is that we are replacing a static (HTML) site with a dynamic one, and we need to try to keep the page rankings as much as possible undisturbed, so the system needs to be able to crate new performers, but these need to be visible to search engines and browsers as whoever.html.

What would you suggest as the best way to achieve this?

cris.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks guys...

300 for glcummins for setting me straight in the first place, and 200 for hernst42 for having a go at the actual syntax...