![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Additional Libraries Users contributed libraries. This sub-forum is only available to licensed users. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
I want to write a personal wiki. Using your library I can read a text file, interpret it and create the required htm.
My problem is I create links that are the name of other text files. Is there a way I can load the text file for interpreting. ![]() My Code so far (just test code) Code:
Sub Globals
'Declare the global variables here.
End Sub
Sub App_Start
Form1.Show
web.New1("Form1",10,30,770,500)
End Sub
Sub Button1_Click
'web.Navigate(Textbox1.Text)
web.url = Textbox1.Text 'either Navigate or assigning to Url will load the web page
End Sub
Sub GetFile(file)
If FileExist (file) = true Then
FileOpen (c1,file,cRead ,, cASCII)
HtmStr = "<html><head><meta http-equiv=Content-Type content=text/html; charset=utf-8>"
HtmStr = HtmStr & "<title>homepage</title>"
HtmStr = HtmStr & "<link rel=stylesheet href=file:///C:\Users\Tony\Documents\WM_Wiki_Pages\Locks\wikistyle.css Type=text/css>"
HtmStr = HtmStr & "</head><body>"
line = FileRead (c1)
Do Until line = EOF
If line <> EOF Then
If SubString(line, 0, 1) = "[" Then
If SubString(line,1,1) = "^" Then
' do nothing
HtmStr = HtmStr & "Insert page here" & crlf
Else
HtmStr = HtmStr & "<p><a class=" & Chr(34) & "internal" & Chr(34) & " href=" & Chr(34)
HtmStr = HtmStr & SubString(line,1, StrLength(line)-2) & ".txt" & Chr(34) & ">" & SubString(line,1, StrLength(line)-2)
HtmStr = HtmStr & " </a> </p>" & crlf
End If
End If
If SubString(line, 0, 1) = "+" Then
HtmStr = HtmStr & "<h1><a name=Locks%20Wiki>"
HtmStr = HtmStr & SubString(line,1, StrLength(line))
HtmStr = HtmStr & "</a></h1>" & crlf
End If
End If
line = FileRead (c1)
Loop
FileClose (c1)
web.DocumentText = HtmStr
End If
End Sub
Sub Button2_Click
GetFile("homepage.txt")
End Sub
Sub web_DocumentCompleted
'Msgbox("Completed", web.Url)
End Sub
Sub web_Navigating
GetFile(web.NavigatingURL)
End Sub
Sub web_Navigated
' Msgbox("Navigated to" & crlf & web.Url)
' Textbox1.Text = web.Url
End Sub
Code:
[^header] +Locks Wiki [Access Control] [Automotive] [Key Cabinets-Boxes] [Locks Via Brand] [Motorcycles] [Padlocks] [Rolla Doors] [Safes] [Technical_Info] [Test] [^footer] |
|
|
| digitaldon37 |
|
This message has been deleted by digitaldon37.
|
|
|||
|
I noticed agraham's suggestion after I posted my reply, so I decided to give it a try. I took your example and made the following mods
1. Added a "splash" page on load - this could be written as an index for the different wikis - after the web.new Code:
web.DocumentText="<html><body><p><a class='internal' href='homepage.txt'>Home Page</a></p></body></html>" Code:
web.DocumentText = HtmStr Code:
Return HtmStr Code:
Sub web_Navigating If web.NavigatingURL = "about:blank" Then url="homepage.txt" Else 'Msgbox (web.NavigatingURL) url=SubString(web.NavigatingURL,6, StrLength(web.NavigatingURL)-6) x=getFile(url) web.DocumentText=x End If End Sub 1. Page loaded with one link to "Home Page" (click on link) 2. Home Page loaded (click on 1st link) 3. New page loaded (wiki text file that I created) Here's your new code: Code:
Sub Globals
'Declare the global variables here.
ReEntry = false ' in Globals
End Sub
Sub App_Start
Form1.Show
web.New1("Form1",10,30,770,500)
web.DocumentText="<html><body><p><a class='internal' href='homepage.txt'>Home Page</a></p></body></html>"
End Sub
Sub Button1_Click
'web.Navigate(Textbox1.Text)
web.url = Textbox1.Text 'either Navigate or assigning to Url will load the web page
End Sub
Sub GetFile(file)
If FileExist (file) = true Then
FileOpen (c1,file,cRead ,, cASCII)
HtmStr = "<html><head><meta http-equiv=Content-Type content=text/html; charset=utf-8>"
HtmStr = HtmStr & "<title>homepage</title>"
HtmStr = HtmStr & "<link rel=stylesheet href=file:///C:\Users\Tony\Documents\WM_Wiki_Pages\Locks\wikistyle.css Type=text/css>"
HtmStr = HtmStr & "</head><body>"
line = FileRead (c1)
Do Until line = EOF
If line <> EOF Then
If SubString(line, 0, 1) = "[" Then
If SubString(line,1,1) = "^" Then
' do nothing
HtmStr = HtmStr & "Insert page here" & crlf
Else
HtmStr = HtmStr & "<p><a class=" & Chr(34) & "internal" & Chr(34) & " href=" & Chr(34)
HtmStr = HtmStr & SubString(line,1, StrLength(line)-2) & ".txt" & Chr(34) & ">" & SubString(line,1, StrLength(line)-2)
HtmStr = HtmStr & " </a> </p>" & crlf
End If
End If
If SubString(line, 0, 1) = "+" Then
HtmStr = HtmStr & "<h1><a name=Locks%20Wiki>"
HtmStr = HtmStr & SubString(line,1, StrLength(line))
HtmStr = HtmStr & "</a></h1>" & crlf
End If
End If
line = FileRead (c1)
Loop
FileClose (c1)
Return HtmStr
' Msgbox(HtmStr)
' web.DocumentText = HtmStr
' Msgbox("complete")
End If
End Sub
Sub Button2_Click
GetFile("homepage.txt")
End Sub
Sub web_DocumentCompleted
'Msgbox("Completed", web.Url)
'Msgbox("web_completed")
End Sub
Sub web_Navigating
If web.NavigatingURL = "about:blank" Then
url="homepage.txt"
Else
'Msgbox (web.NavigatingURL)
url=SubString(web.NavigatingURL,6, StrLength(web.NavigatingURL)-6)
'Msgbox(url)
x=getFile(url)
'Msgbox(x)
web.DocumentText=x
End If
End Sub
Sub web_Navigated
' Msgbox("web_Navigated")
' Msgbox("Navigated to" & crlf & web.Url)
Textbox1.Text = web.Url
End Sub
![]() |
|
|||
|
Thanks that's just a great leg up.
![]() Firstly I think we should now start a new thread for further discussion on my/our wiki program, so as not to clog this thread about Web Browser. I'm not an experienced user of B4PPC so I'm sure to annoy you all again. Thanks heaps to, agraham for Web Browser digitaldon37 for helping get code started Regards Tony |
|
||||
|
The WebBrowser dll provided by Agraham is only able to navigate url, and NT to interact with the web page itself....
But with the http dll, you can retrieve and send information to the website, provided you know how that information need to be formated...
__________________
Paulo Gomes Porto, Portugal PC: Dual-Core 1,8Ghz, 2GB RAM, 80GB HD PPC: Qtek9000, 1GB SD DLL Version Listing |
|
||||
|
Quote:
Code:
DoorObject.New1(false)
....
DoorObject.FromControl(WebName.ControlRef)
DoorObject.RunMethod("Focus") ' this is case-sensitive
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Device or Desktop | DaveW | Questions & Help Needed | 2 | 11-07-2008 01:04 PM |
| Default Browser (Desktop) | bish0p | Questions & Help Needed | 5 | 09-10-2008 09:31 PM |
| When compiling for Device, Desktop code is used | Woinowski | Bug Reports | 6 | 07-03-2008 10:30 PM |
| Different behaviour DeskTop and Device | HARRY | Questions & Help Needed | 2 | 02-22-2008 01:36 PM |
| Using rapi from desktop to copy file from device to desktop | sunnyboyj | Questions & Help Needed | 9 | 02-08-2008 12:40 PM |