Thanx guys, I'm done and it works rather nicely. I've done all the code in a little include file. it uses server.mappath to get the filename and then selects the elements for givin page. I then put all the elements and there contents into a dictionary object so I can get to them easily without looping through a recordset everytime I'm looking for something.
like so...
Code:
<!--#include file="SQLcn.inc"-->
<%
'----------------------------------------------
'------ get the file name and directory -------
'----------------------------------------------
filename=Request.ServerVariables("URL")
pos=instrrev(filename,"/")
pos=instrrev(filename,"/",pos-1) ' I need the file name and the direcotory... one level up
filename=mid(filename,(pos+1),len(filename))
'----------------------------------------------
'----------- set up local connection ----------
'----------------------------------------------
Set lcn=CreateObject("ADODB.Connection")
lcn.Open strNewBuyingSQLcn
'-----------------------------------------------------------
'open recordset with all elements for this page and country
'-----------------------------------------------------------
Set rs=CreateObject("ADODB.RecordSet")
rs.Open "SELECT e.contents as contents, p_e.description as description " &_
"FROM element e " &_
"join page_element p_e on p_e.ID = e.elementID " &_
"join language l on l.id = e.languageID " &_
"join country c on c.languageID = l.id " &_
"join page p on p.id=p_e.pageID " &_
"where lower(rtrim(ltrim(p.description)))='" & filename & "' "&_
"and c.country = '" & Request.Cookies("nb_countryid") & "'", lcn
'---------------------------------------------------------------------------
'---- create a dictionary object to store elements and their contents ------
'---------------------------------------------------------------------------
Dim ElementsOBJ
set ElementsOBJ = server.CreateObject ("scripting.dictionary")
'---------------------------------------------
'-- put all elements into dictionary object --
'---------------------------------------------
if rs.EOF and rs.BOF then
Response.Write "empty!!!"
else
while not rs.EOF
description = lcase(trim(rs("description")))
contents = trim(rs("contents"))
ElementsOBJ.Add description, contents
rs.movenext
wend
end if
'---------------------------------------------
'--------------- clean up --------------------
'---------------------------------------------
rs.close
lcn.close
set rs = nothing
set lcn = nothing
%>
cheers
thanx for the help
Bookmarks