TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Advanced PHP Programming (http://www.talkphp.com/advanced-php-programming/)
-   -   Advance problem trying to generate files. (http://www.talkphp.com/advanced-php-programming/6004-advance-problem-trying-generate-files.html)

hockey97 10-14-2011 06:38 AM

Advance problem trying to generate files.
 
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?

Hershey 11-07-2011 10:54 PM

So, first off help me understand what you mean.

Are you trying to build an application that allowed a person(s) to edit their profile? Or something like that?

If so, lets you should do something like MyBB and other popular applications do. They have a Language file that holds the content of most things. If this is what you need help with, I can most definitely help you! If not, please further explain.

hockey97 11-09-2011 03:15 AM

I don't know what you mean.

what I am talking about is this:

for example lets make facebook.com the example.

well lets say that facebook.com allows you to edit your profile the way it looks.

like you can drag things and move divs, images, input boxes around on the page.

you can delete these elements too or add new ones to the profile page.

what I want is to make a GUI interface not a application but maybe a web app.

that the GUI interface would allow the user to drag and drop elements and delete them and add new ones but also allows the person to program their page without touching any code.

so that means conditions would be those if statements or switch statements.

but I want my scripts to generate that code and save it on a file that is stored on my server for each user.

then later on if they make changes or modified the elements or deleted a few elements then their changes should be saved in that file.


The problem is that I don't know how you can open a file and scan

for certain places inside the code to delete or overwrite on those certain areas.

Hershey 11-09-2011 07:03 AM

Well, what it sounds like you want to do it pretty much build a framework. lol

Which is very advance. If you PM me or send me an email at hershey@hersheysblog.com we can make a project and actually finish this. I wouldn't call it exactly a framework, but it's a web application.

If we create something like this, we could sell it or just put it under the GPL and make it open source.


All times are GMT. The time now is 04:56 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0