Hi, I am trying to generate programming files on the fly.
my user will use a gui to click buttons that for instance on their webapage they will be able to program the webpage how they like it via my gui.
my gui will create the php if statements etc and will create the file for the persons webspage.
here is the problem. I know how to create files and put data to them and us regular expressions to find lines of text inside the file.
the problem is that after I created this webpage file for the users webpage. Later on I want to be able to update the file and make changes to it. Like the user can use my gui to edit the file and update or make any changes to existing code. Not directly of course. I will have a gui interface where my php scripts should be the only ones touching raw code.
now, I know how to generate the if statements and variables and functions etc.
I just don't know how via script I can search for each line of code.
like I don't understand how I can go to a certain if statement and select not just the if and the condition but everything inbetween the { ]} brackets including the brackets themselves.
lets say I need to delete a whole if statement. How can I select this line of code? lets say the if(conditon){ is on line 5 and
the } is on line 20. how can I select all the lines from 5 to 20 and delete everything.
then again what if I don't want to delete the if statement but want to changes the conditions and the code that is applied when those conditions are met.
I been thinking and thinking and asked many many programmers this question and they told me it can't be done every time you make the programming file you have to remake it from scratch you can't just go in a program file and search for certain code and just edit that code.
I was thinking what if I put comments on the start and end of the code. The have comments at the start and end of each program code inside the if statement. that way I can select inbetween those comments to either delete that code and if I need to make changes could put the new code there and might make changes to the comments left.
would that work?
If you don't understand what I am asking then here is a software version:
http://www.hkvstore.com/phpmaker/
it's a software application for your desktop. the program is a GUI they allows you by clicking buttons and selecting stuff from a drop down menu. It will generate the right php,html,css code for you.
you can edit the files later on. The user dosen't touch any code by hand at all.
I don't understand how they store this information into a file first and later if you need to make changes they would make the changes directly to the files.
I want to do the same thing but implement this on a webpage using just php.
how can this be done?