Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Classifieds on Portal.asp

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!
Before posting, make sure you have read this topic!

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
ejm3 Posted - 24 April 2009 : 14:30:33
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.
2   L A T E S T    R E P L I E S    (Newest First)
ejm3 Posted - 24 April 2009 : 19:09:30
Thanks Carefree, I fixed the scrollcode.
Carefree Posted - 24 April 2009 : 18:46:20
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.

Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000 Version 3.4.07