Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help in making text/html editor needed badly

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
i need everyones help/ideas/comments/suggestions on this project i am making. Baisically, this program will be able to open html files and it will allow you to edit the title and the body of the web page ONLY. Also, i want it to be able to edit *.css files. Help me out here guys.
 
im assuming a few things as i write this, #1 you are going to write this app for a corporate setting, #2 the file will not be sitting on the users box, #3 the pages are not ASPs.

I am thinking your gunna have to make a file box that does not show the path.
The html files are going to have to adhere to a strict format regarding placement of the main tags tags.
I suggest you use line input statements putting the lines into an array.
Use an if statement to see if the tag is &quot;<title>&quot; or &quot;<body>&quot; if so get the next lines and keep concatinating the new string into the same array element until the line just read is the corresponding close tags, put the close tag into the next array index.
Feed the &quot;meat&quot; (for lack of better word) into your &quot;editor&quot; for editing by the user.
I suggest a textbox for the title and a separate textbox for the body.
When saving the new text to the existing HTML file make the title array element equal to the title textbox and make the body textbox equal to the body array element, then write the array to the file using print statements inside a loop.

hope this is what you are looking for,
tryp
 
How would i have the program read through the html file to find the tags while the html file is loading though? that is the question that continues to stump me...
 
You could slurp the whole file into a string:

Dim str As String
Dim fnum As Integer

' open file here

str=String(FileLen(fnum),0)
get #fnum,str

Then use Instr() and Mid() to pull out the TITLE and BODY. The biggest difficulty is dealing with cases where the different pages may not deal with the BODY tags consistently (i.e. one may omit the BODY tags entirely, another may leave out the closing BODY tag etc.), this leaves you making guesses as to what's properly part of the BODY and what isn't and as mentioned above, there may be ASP or PHP commands and the like embedded in the page. If you want to filter these out, you'll have to do some more sophisticated string parsing. Then there's the greater difficulty of recreating the HTML file properly.

HTH,

Russ
bobbitts@hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top