Author |
Topic |
StephenD
Senior Member
Australia
1044 Posts |
Posted - 09 December 2003 : 22:46:36
|
Yeah, can't stop playing around with this Portal Mod....
Been trying to get a 'Printer Friendly' page to work for the articles.
I can create a link in portal.asp OK:
Response.Write " <br /><a href=""JavaScript:openWindow5('pop_printer_friendly2.asp" &"?ContentID="& rsContent.Fields("CONT_ID").Value &"&CategoryID=" & TheCat & "')"">" & getCurrentIcon(strIconPrint,"","align=""absmiddle""") & "</a> <a href=""JavaScript:openWindow5('pop_printer_friendly2.asp" &"?ContentID="& rsContent.Fields("CONT_ID").Value &"&CategoryID=" & TheCat & "')"">Printer Friendly</a>" & vbNewLine
It's pop_printer_friendly.asp that I have problems with. Here is a link to a text file of where I'm up to at the moment. pop_printer_friendly2.txt
Can anyone assist to get this working please. I've been trying for a couple of days now. |
Edited by - StephenD on 09 December 2003 22:47:17 |
|
DavidRhodes
Senior Member
United Kingdom
1222 Posts |
Posted - 10 December 2003 : 04:29:05
|
In the SQL statement, you are using the variable "ContentID", it should be "CONT_ID". Nice idea, i'll add this to the next release |
The UK MkIVs Forum |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 10 December 2003 : 04:36:33
|
While you are at it can you add the Next/ Previous Article.
I'm playing with it right now:Sub Article_nav()
if prevArticle = "" then
'strSQL = "SELECT T_SUBJECT, TOPIC_ID "
'strSql = strSql & "FROM " & strActivePrefix & "TOPICS "
'strSql = strSql & "WHERE T_LAST_POST > '" & Topic_LastPost
'strSql = strSql & "' AND FORUM_ID=" & Forum_ID
'strSql = strSql & " AND T_STATUS < 2" ' Ignore unapproved/held posts
'strSql = strSql & " ORDER BY T_LAST_POST;"
strSql = "SELECT "
strSql = strSql & strTablePrefix & "CMS_CONTENT.CONT_ID, "
strSql = strSql & strTablePrefix & "CMS_CONTENT.CONT_TITLE "
strSql = strSql & "FROM " & strTablePrefix & "CMS_CONTENT "
strSql = strSql & "WHERE " & strTablePrefix & "CMS_CONTENT.CONT_LAST_EDIT > '" & ContentLastEdit
strSql = strSql & "'AND " & strTablePrefix & "CMS_CONTENT.CAT_ID = " & CategoryID
strSql = strSql & "ORDER BY " & strTablePrefix & "CMS_CONTENT.CONT_LAST_EDIT "
set rsPrevArticle = my_conn.Execute(TopSQL(strSql,1))
if rsPrevArticle.EOF then
prevArticle = getCurrentIcon(strIconBlank,"","align=""top"" hspace=""6""")
else
'##### Next/Prev Topic Title Hover MOD #####
prevTopic = "<a href=""portal.asp?" & "CONT_ID=" & rsPrevArticle("CONT_ID") & """>" & getCurrentIcon(strIconGoLeft,"" & "Previous Article: " & chkString(rsPrevArticle("CONT_TITLE"),"imagetag") & "","align=""top"" hspace=""6""") & "</a>"
'###########################################
end if
rsPrevArticle.close
set rsPrevArticle = nothing
else
prevArticle = prevArticle
end if
if NextArticle = "" then
strSql = "SELECT "
strSql = strSql & strTablePrefix & "CMS_CONTENT.CONT_ID, "
strSql = strSql & strTablePrefix & "CMS_CONTENT.CONT_TITLE "
strSql = strSql & "FROM " & strTablePrefix & "CMS_CONTENT "
strSql = strSql & "WHERE " & strTablePrefix & "CMS_CONTENT.CONT_LAST_EDIT < '" & ContentLastEdit
strSql = strSql & "'AND " & strTablePrefix & "CMS_CONTENT.CAT_ID = " & CategoryID
strSql = strSql & "ORDER BY " & strTablePrefix & "CMS_CONTENT.CONT_LAST_EDIT DESC;"
set rsNextArticle = my_conn.Execute(TopSQL(strSql,1))
if rsNextArticle.EOF then
nextTopic = getCurrentIcon(strIconBlank,"","align=""top"" hspace=""6""")
else
'##### Next/Prev Topic Title Hover MOD #####
nextTopic = "<a href=""portal.asp?" & "CONT_ID=" & rsNextArticle("CONT_ID") & """>" & getCurrentIcon(strIconGoRight,"" & "Next Article: " & chkString(rsNextArtcile("CONT_TITLE"),"imagetag") & "","align=""top"" hspace=""6""") & "</a>"
'###########################################
end if
rsNextArticle.close
set rsNextArticle = nothing
else
nextArticle = nextArticle
end if
Response.Write (" " & prevArticle & "<b><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHeadFontColor & """> Article </font></b>" & nextArticle)
end sub
Still hammering away |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 10 December 2003 : 04:39:48
|
Forgot to say thanks BTW. Love this Portal Mod... |
|
|
DavidRhodes
Senior Member
United Kingdom
1222 Posts |
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 10 December 2003 : 06:14:00
|
OK, David before v1.2 comes out can you please help me out with my first post. I changed the variable to CONT_ID. I've updated the txt file and here is the relevant code section. Still comes up ' Article Not Found'.
CONT_ID = Request.QueryString("CONT_ID")
if CONT_ID = 0 then
Go_Result "Article not found."
Response.End
end if
dim strSql, rsCont
'## CMS_SQL
strSql = "SELECT "
strSql = strSql & strTablePrefix & "CMS_CONTENT.CONT_ID, "
strSql = strSql & strTablePrefix & "CMS_CONTENT.CAT_ID, "
strSql = strSql & strTablePrefix & "CMS_CONTENT.CONT_TITLE, "
strSql = strSql & strTablePrefix & "CMS_CONTENT.CONT_BODY, "
strSql = strSql & strTablePrefix & "CMS_CONTENT.CONT_DATE, "
strSql = strSql & strTablePrefix & "CMS_CONTENT.CONT_AUTHOR, "
strSql = strSql & strTablePrefix & "CMS_CONTENT.CONT_LAST_EDIT "
strSql = strSql & "FROM " & strTablePrefix & "CMS_CONTENT "
strSql = strSql & "WHERE " & strTablePrefix & "CMS_CONTENT.CONT_ID = " & CONT_ID
'strSql = strSql & "WHERE " & strTablePrefix & "CMS_CONTENT.CAT_ID = " & CAT_ID & " "
set rsCont = my_Conn.Execute (strSql)
if rsCont.EOF then
rsCont.close
set rsCont= nothing
Go_Result "Either the Article was not found<br />or you are not authorized to view it."
Response.End
end if
Any ideas? |
|
|
DavidRhodes
Senior Member
United Kingdom
1222 Posts |
Posted - 10 December 2003 : 06:22:29
|
That looks fine to me, I think the error lies in the link to open it
Response.Write " <br /><a href=""JavaScript:openWindow5('pop_printer_friendly2.asp" &"?ContentID="& rsContent.Fields("CONT_ID").Value &"&CategoryID=" & TheCat & "')"">" & getCurrentIcon(strIconPrint,"","align=""absmiddle""") & "</a> <a href=""JavaScript:openWindow5('pop_printer_friendly2.asp" &"?ContentID="& rsContent.Fields("CONT_ID").Value &"&CategoryID=" & TheCat & "')"">Printer Friendly</a>" & vbNewLine change to
Response.Write " <br /><a href=""JavaScript:openWindow5('pop_printer_friendly2.asp?ContentID="& rsContent.Fields("CONT_ID").Value &"&CategoryID=" & TheCat & "')"">" & getCurrentIcon(strIconPrint,"","align=""absmiddle""") & " Printer Friendly</a>" & vbNewLine |
The UK MkIVs Forum |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 10 December 2003 : 06:52:22
|
Nah, still the same error David. |
|
|
DavidRhodes
Senior Member
United Kingdom
1222 Posts |
Posted - 10 December 2003 : 07:00:37
|
try changing
if CONT_ID = 0 then Go_Result "Article not found." Response.End end if
to
if Len(CONT_ID) < 1 then Go_Result "Article not found." Response.End end if
|
The UK MkIVs Forum |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 10 December 2003 : 07:14:52
|
Still the same sorry. |
|
|
DavidRhodes
Senior Member
United Kingdom
1222 Posts |
Posted - 10 December 2003 : 07:45:20
|
it looks like the querystring is not been passed for some reason. Right-click on the page, select properties and check the Address(URL) |
The UK MkIVs Forum |
|
|
StephenD
Senior Member
Australia
1044 Posts |
|
DavidRhodes
Senior Member
United Kingdom
1222 Posts |
Posted - 10 December 2003 : 08:47:19
|
remove if CONT_ID = 0 then Go_Result "Article not found." Response.End end if
is it really needed anyway? |
The UK MkIVs Forum |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 10 December 2003 : 09:03:12
|
I now get : Microsoft OLE DB Provider for SQL Server error '80040e14'
Line 1: Incorrect syntax near '='.
/pop_printer_friendly2.asp, line 64
'## CMS_SQL
strSql = "SELECT "
strSql = strSql & strTablePrefix & "CMS_CONTENT.CONT_ID, "
strSql = strSql & strTablePrefix & "CMS_CONTENT.CAT_ID, "
strSql = strSql & strTablePrefix & "CMS_CONTENT.CONT_TITLE, "
strSql = strSql & strTablePrefix & "CMS_CONTENT.CONT_BODY, "
strSql = strSql & strTablePrefix & "CMS_CONTENT.CONT_DATE, "
strSql = strSql & strTablePrefix & "CMS_CONTENT.CONT_AUTHOR, "
strSql = strSql & strTablePrefix & "CMS_CONTENT.CONT_LAST_EDIT "
strSql = strSql & "FROM " & strTablePrefix & "CMS_CONTENT "
strSql = strSql & "WHERE " & strTablePrefix & "CMS_CONTENT.CONT_ID = " & CONT_ID
'strSql = strSql & "WHERE " & strTablePrefix & "CMS_CONTENT.CAT_ID = " & CAT_ID & " "
set rsCont = my_Conn.Execute (strSql)
Thanks for your attention tonight David. |
|
|
DavidRhodes
Senior Member
United Kingdom
1222 Posts |
Posted - 10 December 2003 : 10:22:41
|
It's definitely not reading the querystring for some reason. Copy this before the sql
response.write("ContentID = " & CONT_ID) response.end
It's the afternoon by th way |
The UK MkIVs Forum |
|
|
StephenD
Senior Member
Australia
1044 Posts |
Posted - 10 December 2003 : 10:25:28
|
This is what is output: ContentID = |
|
|
Topic |
|