View Full Version : ***SOLVED***Embedded??? Dynamic Data

03-28-2006, 09:24 PM
Ok too much to explain so ill make this short, need to be able to pull dynamic data into a webpage that is already pulling all of its content from a database. I realize its badly designed but the record being pulled has actual HTML code within it. And that code needs to have another dynamic element within it.....

So my first remedy was to use an IFrame to pull the data in.... which actually worked well.... until it came time to make a printer friendly of the page. The iframes print blank, which after researching i found out why. Since there are more then 1 iframes pulling data and since you must somehow focus to the iframe before its data will print, I am posed with a very serious delima... how do I get the data to display & print without causing me a major headache or having to entirely redo the handbook system.

03-28-2006, 10:32 PM
Use the XMLHTTP object to scrape the page(s) that you want to display. Then you don't need an IFrame.

03-29-2006, 03:38 PM
That would work great if I could include ASP code into the actual record... but theres around 800 records with HTML code in each... and those need to pull names from another database... maybe I am approaching this at the wrong angle? However it is too late to do it differently the system is already built and running... I just need to somehow be able to pull data into a database record, then display and print it.

03-30-2006, 04:44 PM
That did work great... I just had to take it a step further.... see below

function StartPosition(data_str)

Dim str_var
str_var = data_str
start_pos = InStr(str_var,"<!--url=")
if (start_pos = 0) then
StartPosition = FALSE
StartPosition = start_pos + 8
end if

end function

function FinishPosition(data_str)

Dim str_var
str_var = data_str
finish_pos = InStr(str_var,"||-->")
if (finish_pos = 0) then
FinishPosition = FALSE
FinishPosition = finish_pos
end if

end function

function GetSourceUrl(start_var, finish_var, src_var)

Dim st_var, f_var, s_var, url_var, len_var
st_var = start_var
f_var = finish_var
s_var = src_var
len_var = finish_var - start_var
url_var = Mid(s_var,st_var,len_var)
GetSourceUrl = url_var

end function

function ProcessInclude(url)

Dim objxmlhttp, strscrape, strURL
strURL = url
Set objxmlhttp = Server.Createobject("Microsoft.xmlhttp")
objxmlhttp.Open "GET", strURL, False
strscrape = objxmlhttp.responseText
Set objxmlhttp = Nothing

end function

function CheckSourceData(src)

DIM start_var, finish_var, post_len
DIM precode_str, postcode_str

start_var = StartPosition(src)
if (start_var < 1) then
finish_var = FinishPosition(src)
precode_str = Left(src,start_var+1)
post_len = Len(src) - finish_var - 4
postcode_str = Right(src,post_len)
url_var = GetSourceUrl(start_var,finish_var,src)
end if

end function