Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Classifieds on Portal.asp
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ejm3
Starting Member

4 Posts

Posted - 24 April 2009 :  14:30:33  Show Profile  Visit ejm3's Homepage  Reply with Quote
I have the classifieds mod and the portal mod installed. The classifieds only have 1 link in the site navigation and no way to show if a new one has been added.

I put together the following sub (mainly copied and pasted from the previous sub) so the latest classifieds show up on my portal.asp page.

Only the stuff between '##########My Additions##########:



sub DisplayActiveTopics(byval Width, byval Count)

dim strSql
dim rsActive

Call StartTable(Width, "Active Topics")

strSql = "SELECT"
strSql = strSql & " T.TOPIC_ID,"
strSql = strSql & " T.T_SUBJECT"
strSql = strSql & " FROM " & strTablePrefix & "TOPICS T," & strTablePrefix & "FORUM F"
strSql = strSql & " WHERE T.FORUM_ID = F.FORUM_ID"
strSql = strSql & " AND F.F_PRIVATEFORUMS = 0"
strSql = strSql & " AND T.T_STATUS = 1"
strSql = strSql & " ORDER BY T_LAST_POST DESC"

Set rsActive = my_conn.Execute(TopSQL(strSql, Count))
If NOT rsActive.EOF Then
Do While NOT rsActive.EOF

Response.Write("<a href=""topic.asp?TOPIC_ID="& rsActive.fields("TOPIC_ID").value &""">"& rsActive.fields("T_SUBJECT").value & "</a><br><br>")

rsActive.MoveNext
Loop
End If
rsActive.Close
Set rsActive = Nothing

Response.Write " <a href=""active.asp"">more active topics</a>" &vbCrLf

Call EndTable()

end sub

'##########My Additions##########
sub DisplayClassifieds(byval Width, byval Count)

Call StartTable(Width, "Classifieds")

dim rsAds
dim strClassSql

set rsAds = server.CreateObject("adodb.recordset")

'get the ads for this category
strClassSql = "Select ID, ad_title, city,"
strClassSql = strClassSql & "link FROM " & strTablePrefix & "ADS_CONTENT ORDER BY date_posted desc"
strClassSql = TopSQL(strClassSql, Count)
Set rsAds = my_Conn.Execute(strClassSql)

If NOT rsAds.EOF Then
Do While NOT rsAds.EOF

Response.Write("<a href=""classdetail.asp?id="& rsAds("ID") &""">"& rsAds("ad_title") & "</a><br>")
Response.Write(rsAds("City") & "<br>")

rsAds.MoveNext
Loop
End If
rsAds.Close
Set rsAds = Nothing

Response.Write " <br><a href=""classifieds.asp"">more classifieds</a>" &vbCrLf

Call EndTable()

end sub
'##########My Additions##########



I am very new to coding and learning quite a bit by searching these forums. I was just hoping that someone could take a look at this and make sure it's not messed up. The code works, but I don't want to leave any loose ends or make my database vulnerable. I would also like to hear if my tabs (indents) are sloppy.

Thanks

PS - I don't know how to use the scroll boxes that others use here. If someone lets me know, I would appreciate it.

Edited by - ejm3 on 24 April 2009 19:08:23

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 24 April 2009 :  18:46:20  Show Profile  Reply with Quote
I'm overdue for my pain meds and not thinking too clearly. I'll let someone else review your code.

As for the scroll code, it's simply scrollcode and / scrollcode. To list code properly within it (so it can be cut/pasted), use scrollcode followed by code, and end with / code followed by / scrollcode.
Go to Top of Page

ejm3
Starting Member

4 Posts

Posted - 24 April 2009 :  19:09:30  Show Profile  Visit ejm3's Homepage  Reply with Quote
Thanks Carefree, I fixed the scrollcode.

Edited by - ejm3 on 24 April 2009 19:11:52
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.15 seconds. Powered By: Snitz Forums 2000 Version 3.4.07