tags:

views:

68

answers:

2

I have a PHP file that contains a lot of "if" and "else" statements that determine what content a user sees (let's called this a block). I constantly have to modify this file (let's call it output.php), but it's a bit cumbersome with just a text editor.

What I want to do is use a simple web interface to modify output.php. I was thinking of using a PHP script that would break up output.php into chunks with links to forms where can I can modify each chunk. Here's an example:

output.php format:

<block A>
   title = ...
   description = ...
<block B>
   title = ...
   description = ...
...

script that modifies output.php

<Link to a form that I can use to edit block A, and save>
<Link to a form that I can use to edit block B, and save>
...
<buttons that let me add new blocks, etc.>

It's just a simple interface that lets me edit output.php. I was wondering if there's an easy method to do this in PHP?

Also, would anyone recommend that I start using databases to manage this data? It started off from just two blocks of data with an if/else statement, but now there's going to be up to a hundred blocks.

+3  A: 

Why not just put each "block" in its own file and use include/require?

Although, yeah, if this is basically a content management system, you should probably use a database. Or, use a content management system that's already been built, like WordPress.

mgroves
I think his point was to modify the file without needing to modify and then upload the script to the server. Or something along those lines. But how you described this is how I would have done it. :)
MitMaro
+2  A: 

Start using database and relations, create one-to-many relation between user table (users) and access table (allowed parts).

usoban