Jump to content

building websites offline with php


Recommended Posts

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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:

  1. You have a site.
  2. You upload a text file to the site.
  3. 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 by Andou
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.