unclesirbobby Posted January 11 Share Posted January 11 I am hoping to use php to build a website using offline using apache server. Just to clarify I will be making a website using php to generate html files from text files. Then I will be able to change a template so that I can generate lots of web pages easily. Has anyone got any advice? Quote Link to comment https://forums.phpfreaks.com/topic/317622-building-websites-offline-with-php/ Share on other sites More sharing options...
Olumide Posted January 11 Share Posted January 11 I guess this question should fits under PHP Coding Help. Quote Link to comment https://forums.phpfreaks.com/topic/317622-building-websites-offline-with-php/#findComment-1614081 Share on other sites More sharing options...
requinix Posted January 11 Share Posted January 11 Moved. 7 hours ago, unclesirbobby said: I am hoping to use php to build a website using offline using apache server. That is typically why people install Apache, or bundles like WAMP and XAMPP. 7 hours ago, unclesirbobby said: Just to clarify I will be making a website using php to generate html files from text files. Then I will be able to change a template so that I can generate lots of web pages easily. Has anyone got any advice? First piece of advice is that generating HTML files is probably the wrong way to do this. How about some more information? What is it you're developing? What are these text files and HTML files? Quote Link to comment https://forums.phpfreaks.com/topic/317622-building-websites-offline-with-php/#findComment-1614088 Share on other sites More sharing options...
Andou Posted January 19 Share Posted January 19 (edited) On 1/11/2024 at 6:55 AM, unclesirbobby said: I am hoping to use php to build a website using offline using apache server. Just to clarify I will be making a website using php to generate html files from text files. Then I will be able to change a template so that I can generate lots of web pages easily. Has anyone got any advice? If I were you, I would have it so you upload a text file, like so (almost like pseudocode): BEGIN PAGE BEGIN TITLE = "My Web Page" END TITLE BEGIN BODY COMMENT "Your content goes here" END COMMENT END BODY END PAGE And then write a parser to detect "BEGIN" and "END" and replace that with the relevant html tag (i.e. "BEGIN TITLE" = <title>, "END TITLE" = </title>). This is what most template engines do, so I wouldn't necessarily do it myself or reinvent the wheel. (You would also be writing your own template language a la the parser, so I wouldn't do this unless I had to. Take it as a proof-of-concept.) * * * So, assuming you'd do it your way, am I correct in assuming this is how it works: You have a site. You upload a text file to the site. Your PHP code scans the text file and outputs HTML from it. But requinix is correct, we really do need a little more information. Is there any reason you can't use PHP itself to build the site? * * * edit: As it turns out, I put your query in google and StackOverflow has a solution. Edited January 19 by Andou Quote Link to comment https://forums.phpfreaks.com/topic/317622-building-websites-offline-with-php/#findComment-1614222 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.