-
Jul 9th, 2010, 03:56 PM
#1
Thread Starter
Lively Member
[RESOLVED] HTML Editor Problem
Well my HTML editor reads the text from the HTML file and puts it in a richtextbox, just like a text file, but when I read the file I loose the root directory of the file. Like if the image is in the root directory of the HTML file it would say that the image is in "/image.png" or whatever, but when I preview it in the webbrowser it loses all the images. My only idea to fix this is to save a temporary HTML file and then open it in the browser, rather than changing the source of the webpage to what I typed.
-
Jul 9th, 2010, 04:44 PM
#2
Re: HTML Editor Problem
Add this inside the HEAD section of your html page:
Code:
<base href="http://www.yourwebsite.com/" />
The <base> tag specifies a default address or a default target for all links etc. on a page. So it will automatically add this part to the path, wherever required.
-
Jul 9th, 2010, 06:41 PM
#3
Thread Starter
Lively Member
Re: HTML Editor Problem
I dont think that that will work to good...
-
Jul 10th, 2010, 02:45 AM
#4
Re: HTML Editor Problem
Originally Posted by reconrey
I dont think that that will work to good...
Why so?
That's what the <base> tag is meant for.
-
Jul 10th, 2010, 09:16 AM
#5
Thread Starter
Lively Member
Re: HTML Editor Problem
yea but if somebody uses my HTML editor to create a webpage that they wish to publish, they will then have to remove that code line...
-
Jul 10th, 2010, 09:20 AM
#6
-
Jul 10th, 2010, 09:30 AM
#7
Thread Starter
Lively Member
Re: HTML Editor Problem
.......I am making my own.....
-
Jul 10th, 2010, 09:32 AM
#8
Re: HTML Editor Problem
Originally Posted by reconrey
.......I am making my own.....
No, really?
I got that part, I was merely making a suggestion that in some cases, it doesn't pay to re-invent the wheel.
Gary
-
Jul 10th, 2010, 09:42 AM
#9
Thread Starter
Lively Member
Re: HTML Editor Problem
...i wanted to make one so I can add features to it that other HTML editors dont have...
-
Jul 10th, 2010, 09:45 AM
#10
Re: HTML Editor Problem
In which case, both of the samples that I linked to provide full source code, why not start with one of these as your base, and add the features that they are lacking.
The reason I am saying this, is that they are likely to have overcome a lot of the early issues that you are going to face, leaving you to add the additionals features that you want.
Gary
-
Jul 10th, 2010, 09:47 AM
#11
Thread Starter
Lively Member
Re: HTML Editor Problem
i already have the entire thing made from scratch...I just figured out that bug and I need a solution for it...
-
Jul 10th, 2010, 11:12 AM
#12
Re: HTML Editor Problem
Originally Posted by reconrey
yea but if somebody uses my HTML editor to create a webpage that they wish to publish, they will then have to remove that code line...
Handle that internally.
When displaying in your editor, you put that tag. But while saving the file etc. you don't put that tag.
-
Jul 10th, 2010, 02:19 PM
#13
Thread Starter
Lively Member
Re: HTML Editor Problem
o man i luv u...
-
Jul 10th, 2010, 04:06 PM
#14
Re: HTML Editor Problem
It that your question answered?
If so, remember to mark your thread resolved.
Gary
-
Jul 10th, 2010, 05:00 PM
#15
Thread Starter
Lively Member
Re: HTML Editor Problem
ok...I cant figure out how to add that tag internally....
-
Jul 10th, 2010, 06:13 PM
#16
Thread Starter
Lively Member
Re: HTML Editor Problem
any ideas on how I would do this?
-
Jul 11th, 2010, 03:33 AM
#17
Re: HTML Editor Problem
Hey,
You are going to need to help us to help you.
Can you show some of the code that you are using to display the HTML in the WebBrowser?
Gary
-
Jul 11th, 2010, 12:12 PM
#18
Re: HTML Editor Problem
This would be somewhat the logic you would need to go with.
vb.net Code:
Dim BaseTag as String Dim FileData as String Sub LoadFile() 'or create file, whatever teh case maybe BaseTag = String.Format("<base href=""{0}"" />", "http://www.yourwebsite.com/") '... file load logic goes here... FileData = FileData.Replace("</head>", BaseTag & "</head>") '... load the FileData in your webbrowser after this.... End Sub Sub SaveFile() Dim textToSave As String = FileData.Replace(BaseTag, "") '... logic to save file goes here... End Sub
-
Jul 12th, 2010, 01:16 PM
#19
Thread Starter
Lively Member
-
Jul 13th, 2010, 01:03 AM
#20
Re: [RESOLVED] HTML Editor Problem
Hey,
You might want to think about posting the final code that you used. That way, if someone else is looking for the same thing they will be able to learn.
Gary
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|