I have a news website, with asp pages. It has publishing software which allows you to add articles in a database, and then calls them up from links etc. I have added dynamic meta tags in 2 parts. The first part is in the inc.header.asp file which is called up on every page. The page itself has the meta tag variable, ie. title, description. They work fine on all pages, except the one below i'm having problems with. Ironically it's the most important page, because it's the page that shows the full page article. (view.asp) The reader reaches view.asp by clicking on the article headline in the page before for example here it is called "articlelist.asp". I have included relevant code from the 2 pages here,
Here is a bit of relevant code from the page where the news links are listed (lets call it "articlelist.asp") is this one, and here is one such link, which is a headline, summary and possible image, and other info. -
<div align="justify"><a class="aTITLE_BLUE" href="view.asp?ID=<%=NID%>"><%=TITLE%></a><br />
-
<%IF NOT (IMAGE = "" OR IsNull(IMAGE)) THEN%>
-
<img src="<%=IMAGE%>" width="50" height="50" align="left" />
-
<%END IF%>
-
<span class="style2"><%= FormatDateTime(POSTED,DATE_F) %></span> <span class="tdSUMMARY"><%= SUMMARY %> </span>
-
<%IF NOT I_SIDE = SHOW_HL THEN%>
-
</div>
-
<hr align="JUSTIFY">
-
<div align="justify">
-
<%End If%>
When a reader clicks on the link above, it takes them to the complete article which is view.asp page with the added NID article number showing in the url.
What happens at present , is that the meta tags on all the view.asp pages are the same, as i've put them at the top of the view.asp page. Obviously i need to add them to the article when i do it at the admin side of the software. These articles are not as include files Bill, the include files are soemthing else. The articles are pulled up as you will see below.
Below are the relevant parts of the view.asp page, where the article is actually shown. The page is split in 3 columns. The first column is called "left column" there is some code here, which i didn't bother showing you as the article is in the middle column, ie. "main article" column which is where the news article is pulled from the database, and the third column is pulled from "inc.footer.asp", again irrelevant. Thus the "left column" and "inc.footer" column are no problem, its the "main article" that needs attention and as you will see the title of the article is called from the database. It is included in the page content, but i want to make sure that each view.asp page shows the title and other meta detail . From the code that shows now, the meta tags are always the same no matter what the article as they are added at the top of the view.asp. I need to add them to the database i think. Am i correct? I hope not, i hope i can add them to the article when i am adding it from the admin software.....i tried this, ie. adding it as code, but the problem then was it didn't show in the header of the view.asp page, it showed only in the content of the article when i viewed "view source" from the web. -
<%
-
title = "article title"
-
meta_description = "the description goes here"
-
meta_keywords = "this, is, the, keyword, section,"
-
%>
-
<!--#include file="inc_header.asp"-->
-
-
-
<% Dim SQL, RS, ID, TITLE, CONTENT, SUMMARY, POSTED, ALLOW_C, ALLOW_V, UPDATED, MESSAGE, VOTED, ALLOW_V_MAIN, _
-
ALLOW_C_MAIN, NID, AUTHOR, CATEGORIES, AID, USE_VIEW, NIMAGE
-
Dim CCOUNT, C_ID, C_NAME, C_EMAIL, C_COMMENT, C_DATE, C_SUBJECT, C_M_ID, C_ALLOW_E, C_CITY, C_COUNTRY, _
-
RCOUNT, RID, RTITLE, ACOUNT
-
-
-
NID = Trim(Request.QueryString("ID"))
-
VOTED = Trim(Request.Cookies("NEWS_ARTICLE_" & NID))
-
MEMBER_ID = Trim(Session("PMMS_ID"))
-
IF Trim(Session("PMMS_IN")) = "True" THEN blLOGGED_IN = True
-
-
IF IS_VALID_ID(NID) THEN
-
-
Call OPEN_DB()
-
-
SQL = "SELECT fldA_V, fldA_C FROM nm_tbl_settings WHERE ID = 1"
-
Set RS = Server.CreateObject("ADODB.Recordset")
-
RS.LockType = 1
-
RS.CursorType = 0
-
RS.Open SQL, MyConn
-
IF NOT RS.EOF THEN
-
ALLOW_V_MAIN = trim(RS("fldA_V"))
-
ALLOW_C_MAIN = trim(RS("fldA_C"))
-
END IF
-
RS.Close
-
-
SQL = "UPDATE nm_tbl_news SET fldVIEWS = fldVIEWS + 1 WHERE ID = " & NID
-
MyConn.Execute(SQL)
-
-
SQL = "SELECT fldTITLE, fldCONTENT, fldSUMMARY, nm_tbl_news.fldACTIVE AS ACTIVE, fldAID, fldPOSTED, fldEXPIRES, nm_tbl_news.fldIMAGE AS NIMAGE, fldALLOW_COMMENTS, fldALLOW_VOTING, fldCREATED, fldUPDATE, nm_tbl_agent.fldNAME AS ANAME, nm_tbl_news.fldAID AS AID, fldUSE_VIEW FROM nm_tbl_news, nm_tbl_agent WHERE (nm_tbl_agent.ID = nm_tbl_news.fldAID) AND (nm_tbl_news.fldACTIVE = 1) AND nm_tbl_news.ID = " & NID ' { AND (Now() - {GetDate()} BETWEEN fldPOSTED AND fldEXPIRES)) }
-
response.write vbNewLine & "<!-- SQL: " & SQL & " -->" & vbNewLine
-
Set RS = Server.CreateObject("ADODB.Recordset")
-
RS.LockType = 1
-
RS.CursorType = 0
-
RS.Open SQL, MyConn
-
IF NOT RS.EOF THEN
-
TITLE = trim(RS("fldTITLE"))
-
CONTENT = trim(RS("fldCONTENT"))
-
SUMMARY = trim(RS("fldSUMMARY"))
-
POSTED = trim(RS("fldPOSTED"))
-
ALLOW_C = trim(RS("fldALLOW_COMMENTS"))
-
ALLOW_V = trim(RS("fldALLOW_VOTING"))
-
UPDATED = trim(RS("fldUPDATE"))
-
AUTHOR = trim(RS("ANAME"))
-
AID = trim(RS("AID"))
-
USE_VIEW= trim(RS("fldUSE_VIEW"))
-
NIMAGE = trim(RS("NIMAGE"))
-
ELSE
-
MESSAGE = MESSAGE & "<li />This article is currently not available."
-
END IF
-
response.write vbNewLine & "<!-- SQL: " & SQL & " -->" & vbNewLine
-
RS.Close
-
-
CONTENT = ReplaceAuthorTokens(AID, CONTENT)
-
CATEGORIES = GET_CATES(NID)
-
-
' Get settings
-
Dim DATE_F
-
DATE_F = GET_SETTINGS(False, "fldDATE_F")
-
-
TITLE = PROCESS_SHORTCUTS(False, TITLE)
-
CONTENT = PROCESS_SHORTCUTS(False, CONTENT)
-
SUMMARY = PROCESS_SHORTCUTS(False, SUMMARY)
-
-
ELSE
-
-
MESSAGE = MESSAGE & "<li />No article has been found."
-
-
END IF
-
%>
-
-
<% IF NOT MESSAGE = "" THEN %>
-
<!--#include file="inc_error.asp"-->
-
-
<% Response.End %>
-
<% END IF %>
-
-
-
<%IF USE_VIEW = "1" THEN ' News Agency Template %>
-
-
-
<table width="658" align="center" cellpadding="2" cellspacing="0" border="0">
-
<tr>
-
<td width="150" valign="top">
-
<!-- Left Column -->
-
-
-
-
<!-- [ Left Column ] --> </td>
-
<td width="460" valign="top">
-
<!-- Main Article -->
-
-
-
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
-
<tr>
-
<td colspan="6" align="left" class="ArticleTitle"><%= TITLE %></td>
-
<tr>
-
<td align="left" valign="bottom">Filed under <em><%=CATEGORIES%></em> - on <%= FormatDateTime(POSTED,DATE_F) %>
-
<%IF SHOW_AUTHOR = True THEN%> - By: <%=AUTHOR%> <%END IF%> </td>
-
-
-
<hr size="1" style="color: grey;height: 3px;width: 100%;"/>
-
<div class="tdSUMMARY"><%=CONTENT%></div> <br />
-
-
<br />
-
<br />
-
-
<a href="#talkback1" class="CateLink" >Comment on this article! Talkback</a><br />
-
-
-
-
<% END IF ' { IF USE_VIEW = "1" THEN ' News Agency Template } %>
-
-
-
<p> </p>
-
<p>
-
-
-
<%
-
MyConn.close
-
Set MyConn = Nothing
-
%>
-
<!--#include file="inc_footer.asp"-->
21 7311
From your post, it appears you know how to get the data from the database, but don't know how to put it in your web page. If that is the case, this is the solution: - <%
-
title = "article title" %>
-
<title><%=title%></title>
-
<%
-
meta_description = "the description goes here" %>
-
<meta name="description" content="<%=meta_description%>">
-
<%
-
meta_keywords = "this, is, the, keyword, section," %>
-
<meta name="keywords" content="<%=meta_keywords%>">
-
<!--#include file="inc_header.asp"-->
Although it sure would be useful if this was in the inc_header.asp file. Are you sure it's not there?
Jared
Or is it that you want the meta tags to be different depending on which article they user is looking at? Like if they're looking at "How to build a dog house" then the meta tag would be
Keywords="dog house, dog, house, building, do it yourself, DYI"
or if they're looking at "Home remedies to get rid of a rash"
Keywords="rash, itchy, home remedies, remedies"
??
Or is it that you want the meta tags to be different depending on which article they user is looking at? Like if they're looking at "How to build a dog house" then the meta tag would be
Keywords="dog house, dog, house, building, do it yourself, DYI"
or if they're looking at "Home remedies to get rid of a rash"
Keywords="rash, itchy, home remedies, remedies"
??
yes MarkRawlingson, that is what i want. Otherwise at the moment, the tags work perfectly onall the pages. They even work on the view.asp page but this is the page that needs to pull up the article from the database. As you can see, the way they are now, they pull up all the same on every page. They work, but i need to draw the variable from the middle of the page from the article in the database. its a stupid complicated problem to me but maybe there is a simple solution?
im not html literate, and i hope i don't have to fiddle with the database, as it was done for me. Im hoping there is a simple solution to this.
The main problem seems to be that the templates for the articles are in the software, which means when i add them to the content of the article they show (only in "view source" though) in the content, not in the header, like i want them to.
Thanks for any tips, bear in mind, im not html literate.
From your post, it appears you know how to get the data from the database, but don't know how to put it in your web page. If that is the case, this is the solution: - <%
-
title = "article title" %>
-
<title><%=title%></title>
-
<%
-
meta_description = "the description goes here" %>
-
<meta name="description" content="<%=meta_description%>">
-
<%
-
meta_keywords = "this, is, the, keyword, section," %>
-
<meta name="keywords" content="<%=meta_keywords%>">
-
<!--#include file="inc_header.asp"-->
Although it sure would be useful if this was in the inc_header.asp file. Are you sure it's not there?
Jared
Jared, i already have the inc.header file set up, and the meta tags work on all pages dynamically. They even work on the view.asp page.
MarkRawlingson above understood what i meant i think.
Thank you both for replying. Much appreciated:)
It is a simple solution and there are numerous ways you could go about doing this - you COULD include the keywords in the database. It would be the easiest and most direct way of doing things. The only problem is you would have to manually define the keywords yourself before placing them into the database. -
<meta keywords="<%=rs("mykeywords")%>">
-
which would pull your keywords from the database and apply them to the meta tag depending on which article the individual is looking at. Similarly with the other meta.
That would be the simplest and easiest solution, however if you really don't want to touch the database then I would suggest using a SELECT CASE statement or a series of If.. Elseif.. Else.. statements -
<%
-
SELECT CASE Request.Querystring("id")
-
CASE "1"
-
sKeywords = "Dog, Dog House, House, DYI, Do It Yourself"
-
Case "2"
-
sKeywords = "keyword1, keyword2, keyword3"
-
%>
-
<meta keywords="<%=sKeywords%>">
-
This could get complicated VERY quickly because you would have to manually input each list of keywords into your script for each individual article.
You could write a very complicated function to scrape the article itself for predefined keywords, based off of the article's title i guess (?), place them into a string, and then put that into the meta tag - that would be a really large pain in the butt.. but the end result would be pretty neat if you could pull it off.
It is a simple solution and there are numerous ways you could go about doing this - you COULD include the keywords in the database. It would be the easiest and most direct way of doing things. The only problem is you would have to manually define the keywords yourself before placing them into the database. -
<meta keywords="<%=rs("mykeywords")%>">
-
which would pull your keywords from the database and apply them to the meta tag depending on which article the individual is looking at. Similarly with the other meta.
That would be the simplest and easiest solution, however if you really don't want to touch the database then I would suggest using a SELECT CASE statement or a series of If.. Elseif.. Else.. statements -
<%
-
SELECT CASE Request.Querystring("id")
-
CASE "1"
-
sKeywords = "Dog, Dog House, House, DYI, Do It Yourself"
-
Case "2"
-
sKeywords = "keyword1, keyword2, keyword3"
-
%>
-
<meta keywords="<%=sKeywords%>">
-
This could get complicated VERY quickly because you would have to manually input each list of keywords into your script for each individual article.
You could write a very complicated function to scrape the article itself for predefined keywords, based off of the article's title i guess (?), place them into a string, and then put that into the meta tag - that would be a really large pain in the butt.. but the end result would be pretty neat if you could pull it off.
thnak you MarkRawling
well i have to add each article manually into the database throught the admin. USing a template. I prefer the 2nd method, if there isn't anything better, Where does the code actually go on the page? ie. where do i put it?
I think the last solution would be the best, if i could pull up the title from the title string that would be great. and Description could be the first 10 words of the summary, or something
It will go somewhere at the top of your page, so that you can define the keywords - and then set them into the meta tags.
so... -
<%
-
'pull down the ID from the querystring that pertains to the record that you want to set keywords for
-
select case Request.QueryString("id")
-
Case "1" 'If the ID from the qstring = 1 Then the keywords will be as follows
-
sKeywords = "some, keywords, associated, with, the, article"
-
Case "2" 'if the id from the qstring = 2 then the keywords will be different
-
sKeywords = "some, keywords, which, are, different"
-
End Select
-
'You're setting the keywords into a variable, and then spitting that variable out into the meta tag. Whatever 'sKeywords' holds, the meta tag will hold. You could set your description and other meta tags similarly.
-
%>
-
<html>
-
<head>
-
<title><%=articletitle%></title>
-
<!--Set the keywords into the meta tag itself. -->
-
<meta keywords="<%=sKeywords%>">
-
</head>
-
<body>
-
</body>
-
</html>
-
I do warn you though, If you do it this way you will have to manually define different keywords for each article.. if you don't they won't show up. So say you have 1000 articles... Well, you get the picture!
The last solution would be very difficult to accomplish.. You would have to basically have an asp function written that would grab the title of the article, and cross reference the content of the article, scraping out keywords from it that pertain to the title - and then set the keywords into the meta tag. It depends on your level of expertise.
Sincerely,
Mark
It will go somewhere at the top of your page, so that you can define the keywords - and then set them into the meta tags.
so... -
<%
-
'pull down the ID from the querystring that pertains to the record that you want to set keywords for
-
select case Request.QueryString("id")
-
Case "1" 'If the ID from the qstring = 1 Then the keywords will be as follows
-
sKeywords = "some, keywords, associated, with, the, article"
-
Case "2" 'if the id from the qstring = 2 then the keywords will be different
-
sKeywords = "some, keywords, which, are, different"
-
End Select
-
'You're setting the keywords into a variable, and then spitting that variable out into the meta tag. Whatever 'sKeywords' holds, the meta tag will hold. You could set your description and other meta tags similarly.
-
%>
-
<html>
-
<head>
-
<title><%=articletitle%></title>
-
<!--Set the keywords into the meta tag itself. -->
-
<meta keywords="<%=sKeywords%>">
-
</head>
-
<body>
-
</body>
-
</html>
-
I do warn you though, If you do it this way you will have to manually define different keywords for each article.. if you don't they won't show up. So say you have 1000 articles... Well, you get the picture!
The last solution would be very difficult to accomplish.. You would have to basically have an asp function written that would grab the title of the article, and cross reference the content of the article, scraping out keywords from it that pertain to the title - and then set the keywords into the meta tag. It depends on your level of expertise.
Sincerely,
Mark
OK, so i put this at the top of the view.asp page you mean?
i understand that,
but are 2 querystrings necessary, ie. "if"?
if querystring is 1,
if querysting is 2
or does it mean that for each article it continues, ie. 1, then 2 then 3, so if i had 1000 articles i would need to add 1000 times? this would mean i'd have a very long view.asp page?
but are 2 querystrings necessary, ie. "if"?
if querystring is 1,
if querysting is 2
They wouldn't be necessary if you had a field in your database that held the keywords. Because then you could just "SELECT * FROM [tblArticles] WHERE iIDColumn = " & Request.Querystring("id")
Which would pull on only one specific record, pertinent to the one that the user is looking at. Then you could just pull the keywords out of a column in your table, and pop them into the meta tag - clean and easy.
However, if you don't want to / can't mess around with the database then you have to improvise.
So the suggestion is an improvisation - You are 100% correct that you will need to write out
Case #
sKeywords = "the keywords"
For each and every single article. A tedious process, and yes the view.asp page will be longer than 10 arm lengths... that you will have to keep adding to.
There's no two ways about it - You need to know two things : What article the viewer is looking at, and what keywords/meta information is relative to that specific article.
They wouldn't be necessary if you had a field in your database that held the keywords. Because then you could just "SELECT * FROM [tblArticles] WHERE iIDColumn = " & Request.Querystring("id")
Which would pull on only one specific record, pertinent to the one that the user is looking at. Then you could just pull the keywords out of a column in your table, and pop them into the meta tag - clean and easy.
However, if you don't want to / can't mess around with the database then you have to improvise.
So the suggestion is an improvisation - You are 100% correct that you will need to write out
Case #
sKeywords = "the keywords"
For each and every single article. A tedious process, and yes the view.asp page will be longer than 10 arm lengths... that you will have to keep adding to.
There's no two ways about it - You need to know two things : What article the viewer is looking at, and what keywords/meta information is relative to that specific article.
OK thanks for the tip Mark, i will now try it out,
I just had an idea, that may make the view.asp
couldn't i add the variables to another separate page that i create? ie. let's call it variables.htm
Would it work then? I dont want an uneccesarily long view.asp page in case anyone looks at the source code, in that case, they'll see a long list of keywords, as i plan to add at least 6 articles daily.
Thanks, so much
You could, it wouldn't make it any easier to do but it would at least keep the superflous code in a separate file. If you do that i'd suggest just having a separate .asp file as an include with the select case stuff in there.
You could, it wouldn't make it any easier to do but it would at least keep the superflous code in a separate file. If you do that i'd suggest just having a separate .asp file as an include with the select case stuff in there.
yes i realise the work wouldn't be any the less, but it would make the view.asp page neater should anyone view the code.
So assuming the separate file is called "meta.asp" , the code at the top of the view.asp page should start - <!--#include file="meta.asp"-->
and in the meta.asp file i should do this, - <%
-
'pull down the ID from the querystring that pertains to the record that you want to set keywords for
-
select case Request.QueryString("id")
-
Case "1" 'If the ID from the qstring = 1 Then the keywords will be as follows
-
sKeywords = "some, keywords, associated, with, the, article"
-
Case "2" 'if the id from the qstring = 2 then the keywords will be different
-
sKeywords = "some, keywords, which, are, different"
-
End Select
-
'You're setting the keywords into a variable, and then spitting that variable out into the meta tag. Whatever 'sKeywords' holds, the meta tag will hold. You could set your description and other meta tags similarly.
-
%>
-
<html>
-
<head>
-
<title><%=articletitle%></title>
-
<!--Set the keywords into the meta tag itself. -->
-
<meta keywords="<%=sKeywords%>">
-
</head>
-
<body>
-
</body>
-
</html>
Just to clarify, does the above code show the title, and keywords?
thanks , so much Mark
I would set meta.asp to hold JUST the dynamic creation of the meta information.
If you want to set the title, i would just grab that from the database - I'm assuming you at least have a column in the database that holds the title of the article?
META.ASP -
<%
-
SELECT CASE Request.QueryString("ArticleID")
-
CASE 1
-
sKeywords = "whatever"
-
Case 2
-
etc
-
Then include it into view.asp -
<!--#include File="meta.asp"-->
-
<html>
-
<head>
-
<title><%=rs("sTItle")%></title>
-
<meta keywords="<%=sKeywords%>">
-
</head>
-
<!--rest of your page-->
-
From your post, it appears you know how to get the data from the database, but don't know how to put it in your web page. If that is the case, this is the solution: - <%
-
title = "article title" %>
-
<title><%=title%></title>
-
<%
-
meta_description = "the description goes here" %>
-
<meta name="description" content="<%=meta_description%>">
-
<%
-
meta_keywords = "this, is, the, keyword, section," %>
-
<meta name="keywords" content="<%=meta_keywords%>">
-
<!--#include file="inc_header.asp"-->
Although it sure would be useful if this was in the inc_header.asp file. Are you sure it's not there?
Jared
Mark, thank you i will try to work out and fix using your style. But after reviewing the thread, i just realised something else after re-reading what Jared said,
Since i already have the title column in the database, how about i use the title for the meta tags ie. all of them? is that OK?
for example
title could be Title
description could be Title
and keywords could be Title
all the above would be ok i think, and so much more simpler.
What do you both think? sorry about this Mark, after making you write all that, i realised this afterwards, so sorry.
The title of the article is drawn up as <%= TITLE %>
Let me show code which i have at present,
in the view.asp page at the top it says: - <%
-
title = "title"
-
meta_description = "description here"
-
meta_keywords = "keywords here"
-
%>
-
<!--#include file="inc_header.asp"-->
and in the inc.header.asp it says: - <html>
-
<head>
-
<title><%=title%></title>
-
<meta name="Description" content="<%=meta_description%>"<meta>
-
<meta name="Keywords" content="<%=meta_keywords%>"<meta>
I'd like the title to work in title, description and keywords meta tags, ie. if i put
<%= TITLE %> in the tags instead of meta descriptin and meta keywords would it work?
Im thinking it will in description, but in keywords you need comma,s in don't you?
Bear in mind that the code above works on all pages, but i put it there manually. On the view.asp page the pages will be drawn from the database, that's why im having to fiddle with it.
After all this i realised it may be much simpler to change the code to have all 3 meta tags show the title which is drawn out of the database.
What do you and Jared think? I think this was what Jared first recommended,
Yeah you could do that - it will definately work! The only problem with that is that all your meta tags will hold all the same information, and the keywords won't be very useful - which is why i recommended actually setting up keywords specificly descriptive of the article.
However, if you're not really concerned with the actual information that's held within the meta tags - then definately that would be a MUCH easier way to go.
Sincerely,
Mark
Yeah you could do that - it will definately work! The only problem with that is that all your meta tags will hold all the same information, and the keywords won't be very useful - which is why i recommended actually setting up keywords specificly descriptive of the article.
However, if you're not really concerned with the actual information that's held within the meta tags - then definately that would be a MUCH easier way to go.
Sincerely,
Mark
OK Mark, bearing in mind that the title is drawn up by <%= TITLE %> , i presume i should use the code below, which means that i've only changed the view.asp page code , the inc.header.asp is the same. and yes, if iuse the keywords to be teh same as title thats ok. I was more worried about them not having commas. do they still come up even without comma's?
thanks so much.
anyway, in the view.asp page at the top it should say: - <%
-
title = "<%= TITLE %>"
-
meta_description = "<%= TITLE %>"
-
meta_keywords = "<%= TITLE %>"
-
%>
-
<!--#include file="inc_header.asp"-->
and in the inc.header.asp it should say
< - html>
-
<head>
-
<title><%=title%></title>
-
<meta name="Description" content="<%=meta_description%>"<meta>
-
<meta name="Keywords" content="<%=meta_keywords%>"<meta>
I hope the above is OK, what do you think?
Again many thanks.
Keywords are separated with commas. So the whole title will show up as 1 single keyword.
"the title of the article" will be one keyword, rather than : "the, title, of, the, article" as 5 keywords.
It'll work though, and yeah the code you provided should work great for your purposes so long as <%= TITLE %> reprsents the title coming from the database of course!
Sincerely,
Mark
OK, i tried it and i received this error message when you check the page on the web - Microsoft VBScript compilation error '800a0409'
-
-
Unterminated string constant
-
-
/view.asp, line 2
-
-
title = "<%= TITLE
-
------------------^
This is the relevant part of the code i used, in the inc.header.asp - <!--#include file="config.asp"-->
-
<!--#include file="inc_api.asp"-->
-
<% Response.Buffer = True %>
-
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-
<html>
-
<head>
-
<title><%=title%></title>
-
<meta name="Description" content="<%=meta_description%>"<meta>
-
<meta name="Keywords" content="<%=meta_keywords%>"<meta>
and this is the code i used at the top of the view.asp page - <%
-
title = "<%= TITLE %>"
-
meta_description = "<%= TITLE %>"
-
meta_keywords = "<%= TITLE %>"
-
%>
-
<!--#include file="inc_header.asp"-->
-
<%
-
title = "<%= TITLE %>"
-
meta_description = "<%= TITLE %>"
-
meta_keywords = "<%= TITLE %>"
-
%>
-
<!--#include file="inc_header.asp"-->
-
You're putting asp delimiters inside of an asp delimiter block. Remove the <%= %>
Either
title = "TITLE"
or
title = TITLE
Depending on whether or now it's a variable or string text you're trying to set.
Mark
-
<%
-
title = "<%= TITLE %>"
-
meta_description = "<%= TITLE %>"
-
meta_keywords = "<%= TITLE %>"
-
%>
-
<!--#include file="inc_header.asp"-->
-
You're putting asp delimiters inside of an asp delimiter block. Remove the <%= %>
Either
title = "TITLE"
or
title = TITLE
Depending on whether or now it's a variable or string text you're trying to set.
Mark
"sigh"
OK now i tried this, and the error went. -
<%
-
title = "TITLE"
-
-
meta_description = "TITLE"
-
-
meta_keywords = "TITLE"
-
-
%>
-
<!--#include file="inc_header.asp"-->
however, when i went to check view.asp on the web under "view source"
this code was at the top of the page, with the title not drawn from the database - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-
<html>
-
<head>
-
<title>TITLE</title>
-
<meta name="Description" content="TITLE"<meta>
-
<meta name="Keywords" content="TITLE"<meta>
-
<link rel="STYLESHEET" type="text/css" href="styles.css">
If you're setting
title = "TITLE"
Then you're setting a variable called title to hold a STRING value of TITLE and you're not pulling it from the database at all.
To do that you'll need to open a connection object to the database, create a recordset object, pass an SQL statement into the recordset object and open it.
Then you can pull out the information like so
title = rs("nameofthetitlecolumn")
where rs is equal to whatever you named your recordset object
Mark
Post your reply Sign in to post your reply or Sign up for a free account.
Similar topics
1 post
views
Thread by Eric Levin |
last post: by
|
1 post
views
Thread by Fred Newton |
last post: by
|
12 posts
views
Thread by Alan Silver |
last post: by
|
6 posts
views
Thread by Fred Nelson |
last post: by
|
16 posts
views
Thread by Edward |
last post: by
|
8 posts
views
Thread by Taras_96 |
last post: by
|
2 posts
views
Thread by thetechturf.com |
last post: by
| |
5 posts
views
Thread by Nick |
last post: by
| | | | | | | | | | |