|
| |
|
|
Athema
Posts: 5 Joined: 2/11/2009 Status: offline
|
Dynamic Page content - 2/24/2009 14:02:09
Hi ya I have a few sites that have dynamic page results so the pages change quite often, so I was wondering if anyone here has some code that will generate meta keywords and page description and Title based on the page contents being displayed? I would consider paying someone to write it for me if anyone is interenested. Please get in touch if there is someone out there that can help.
|
|
|
|
TexasWebDevelopers
Posts: 720 Joined: 2/22/2002 From: Dallas, TX Status: offline
|
RE: Dynamic Page content - 2/25/2009 9:10:17
I am assuming that you want the keywords and title, etc. to change automatically without input just based on the text that is on the page. This isn't possible to do using straight server-side code. If you have the ability to install a .dll on the server that will convert the html to a text string then there are some examples floating around that might be of help. I was playing with the FSO and was able to give a path to an html page and then grab and write out several existing tags -- but that doesn't get you all the way to where you want to go. <% 'On Error Resume Next Dim geturl, title, description, keywords, strURL, con, results Dim fso, file, path 'path = "\inetpub\wwwroot\websitename\default.asp" ' FileSystemObject Set fso = CreateObject("Scripting.FileSystemObject") ' File Object Set file = fso.OpenTextFile(path, 1, False) ' Reading the contents of the File into strFileContents strFileContents = file.ReadAll ' Keywords key1 = InStr(1, strFileContents, "<meta name=""keywords"" content=""", 1) key1 = key1 + Len("<meta name=""keywords"" content=""") key2 = InStr(key1, strFileContents, """>", 1) keywords = "," & Trim(Mid(strFileContents, key1, (key2 - key1))) & "," keywords = Replace (keywords, "'", " ") ' Description desc1 = InStr(1, strFileContents, "<meta name=""description"" content=""", 1) desc1 = desc1 + Len("<meta name=""description"" content=""") desc2 = InStr(desc1, strFileContents, """>", 1) description = Trim(Mid(strFileContents, desc1, (desc2 - desc1))) description = Replace (description, "'", " ") ' Title tit1 = InStr(1, lcase(strFileContents), "<title>", 1) tit1 = tit1 + Len("<title>") tit2 = InStr(tit1, strFileContents, "</title>", 1) title = Trim(Mid(strFileContents, tit1, (tit2 - tit1))) title = Replace (title, "'", " ") response.write("title: " & title & "<br>") response.write("description: " & description & "<br>") response.write("keywords: " & keywords & "<br>") response.write("url: " & url & "<br>") response.write("mydate: " & mydate & "<br>") %>
_____________________________
Follow us on TWITTER
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|