Solved

Edit page content (html...to...asp)

Posted on 2014-03-06
2
593 Views
Last Modified: 2014-03-12
I want to have:

- links.asp (displays info from data.xml)
- edit.asp (to edit data.xml)
- data.xml

links.asp has some div tags, ul tags (each with a few li). This page gets some ul and li tags texts from data.xml to displays.

If this is practical, could you please give me a simple ul with few items in data.xml to be displayed on links.asp. Also edit.asp to edit data.xml content via a few text boxes on it.

If this is not practical, then what is a better approach? Could use vs 2010.

Thank you.
0
Comment
Question by:Mike Eghtebas
2 Comments
 
LVL 52

Accepted Solution

by:
Scott Fell,  EE MVE earned 500 total points
ID: 39908700
I would start with data.asp that was delimited.  In this case, you can use the CR LF. Your data.asp page would
one.asp
two.asp
three.asp

Open in new window

The edit.asp would use file systemobject to read the text file http://www.4guysfromrolla.com/webtech/faq/FileSystemObject/faq2.shtml and http://www.4guysfromrolla.com/webtech/faq/FileSystemObject/faq3.shtm

Please note, this code is for sample only. I have not tested it and you should always scrub your data before writing and I have not done that here.  
Dim objFSO
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
const strFileName = "D:\webroot\data.asp"
Dim objTextStream

'-------------------- for writing to the file --------------------------------
if request.form("links")<>"" then

Set objTextStream = objFSO.OpenTextFile("C:\SomeFile.txt", fsoForWriting, True)

'Display the contents of the text file
objTextStream.WriteLine request.form("links")

'Close the file and clean up
objTextStream.Close
Set objTextStream = Nothing
end if
'--------------------------------------------------------------


'************* For displaying in text area *****************

const fsoForReading = 1

If objFSO.FileExists("D:\webroot\data.asp") then
	'The file exists, so open it and output its contents
	Set objTextStream = objFSO.OpenTextFile(strFileName, fsoForReading)
	Response.Write "<textarea name=""links"">" & objTextStream.ReadAll & "</textarea>"
	objTextStream.Close
	Set objTextStream = Nothing
Else
	'The file did not exist
	Response.Write strFileName & " was not found."
End If

'******************************
'Clean up
Set objFSO = Nothing

Open in new window


And you can see how you in your links.asp you can use fso to write the data just as I have done in the textarea. I do think it would be easier to use a database though.
0
 
LVL 33

Author Closing Comment

by:Mike Eghtebas
ID: 39924201
Thank you.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now