Author |
Topic |
|
concep86
Junior Member
USA
140 Posts |
Posted - 03 July 2001 : 14:33:00
|
Title: Random Member Spotlight Mod Demo: http://63.209.180.164/ms.asp Installation: 1. simply copy the function code to the file you want to use... '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' <% ''this function gives me a random picture every time the page is loaded Function picofday()
strConnString = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=e:\forum\db\database.mdb" '## MS Access 97 dim objConnection set objConnection = server.CreateObject("adodb.connection") objConnection.Open strConnString query = "SELECT FORUM_MEMBERS.MEMBER_ID, FORUM_MEMBERS.M_PHOTO_URL, FORUM_MEMBERS.M_NAME, FORUM_MEMBERS.M_FIRSTNAME, FORUM_MEMBERS.M_LASTNAME, FORUM_MEMBERS.M_AGE FROM FORUM_MEMBERS WHERE FORUM_MEMBERS.M_PHOTO_URL<>'' " Dim rspod Set rspod= Server.CreateObject("ADODB.Recordset") rspod.Open query, strConnString, 3, , adCmdText
Dim intRnd Randomize Timer intRnd = (Int(RND * rspod.RecordCount))
rspod.Move intRnd
Response.Write " <BR>" Response.Write "<IMG SRC=" & rspod("M_PHOTO_URL") & "><BR>" Response.Write " <BR>" Response.Write "</TD</Tr><Tr><TD bgcolor=""#FFFFFF"">" Response.Write " <BR>" Response.Write " <IMG SRC=""foros/images/arrow.gif""> UserName:<a href=""foros/pop_profile.asp?mode=display&id="& rspod("member_id") & """> " & rspod("M_NAME") & "</A><BR>" Response.Write " <BR>" Response.Write " <IMG SRC=""foros/images/arrow.gif""> Name: " & rspod("M_FIRSTNAME") & " " & rspod("M_LASTNAME") & "<BR>" Response.Write " <BR>" Response.Write " <IMG SRC=""foros/images/arrow.gif""> Age: " & rspod("M_age") & "<BR>" Response.Write " <BR>" Response.Write "<BR><font color=""#990000""><center>Click on username for profile</center></font><BR>" Response.Write " <BR>"
rspod.Close Set rspod = Nothing End Function %>
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 2. Change database connection string 3. Copy function call into page where you want the Member Spotlight to appear
Description: Displays a member spotlight box... I hope Alan takes this as flattery... It looks like the Member Spotlight he has on IAMVIET.com Author: I won't take credit for it... I just worked with some code someone else posted for something else... added a little here and there... Issues: I'm sure this could be done sweeter... like including the forum.... language... things like the table colors , connection string and so forth.. just my first effort. also ... The current version displays member info even where there is no picture... If anyone has the time... you might want to correct that so that it skips the members that do not have a picture posted... Let me know what you think... CONCEP86
Concep86 Webmaster http://www.coneciones.com
Edited by - concep86 on 03 July 2001 18:15:00
Edited by - concep86 on 04 July 2001 09:49:51 |
|
mfindlay
Junior Member
USA
144 Posts |
Posted - 03 July 2001 : 14:37:21
|
Thanks, I was hoping a mod like this would come along! It would be nice however if you could incorporate the forum colors and general look and feel. This would make the mod complete.
By the way, If you want to exclude those profiles that do not have a photo, you could add a WHERE clause to your query so that it read:
WHERE M_PHOTO_URL <> ""
Edited by - mfindlay on 03 July 2001 16:46:15 |
|
|
RDoGG™
Junior Member
USA
329 Posts |
Posted - 03 July 2001 : 16:12:41
|
quote:
Thanks, I was hoping a mod like this would come along!
By the way, If you want to exclude those profiles that do not have a photo, you could add a WHERE clause to your query so that it read:
query = "SELECT FORUM_MEMBERS.MEMBER_ID, FORUM_MEMBERS.M_PHOTO_URL, FORUM_MEMBERS.M_NAME, FORUM_MEMBERS.M_FIRSTNAME, FORUM_MEMBERS.M_LASTNAME, FORUM_MEMBERS.M_AGE FROM FORUM_MEMBERS WHERE M_PHOTO_URL <> ''"
Edited by - mfindlay on 03 July 2001 14:38:44
cool!
nice mod.
|
|
|
concep86
Junior Member
USA
140 Posts |
Posted - 03 July 2001 : 17:14:17
|
****... I did not think of that... Sometimes the simple ones get by us...
I will work on the colors and stuff...
quote:
Thanks, I was hoping a mod like this would come along! It would be nice however if you could incorporate the forum colors and general look and feel. This would make the mod complete.
By the way, If you want to exclude those profiles that do not have a photo, you could add a WHERE clause to your query so that it read:
WHERE M_PHOTO_URL <> ""
Edited by - mfindlay on 03 July 2001 16:46:15
Concep86 Webmaster http://www.coneciones.com
|
|
|
concep86
Junior Member
USA
140 Posts |
Posted - 03 July 2001 : 18:16:17
|
I added the where clause so now only profiles with pictures are selected..
Thanks
quote:
Thanks, I was hoping a mod like this would come along! It would be nice however if you could incorporate the forum colors and general look and feel. This would make the mod complete.
By the way, If you want to exclude those profiles that do not have a photo, you could add a WHERE clause to your query so that it read:
WHERE M_PHOTO_URL <> ""
Edited by - mfindlay on 03 July 2001 16:46:15
Concep86 Webmaster http://www.coneciones.com
|
|
|
dayve
Forum Moderator
USA
5820 Posts |
Posted - 03 July 2001 : 22:45:52
|
some members screwed up their profile by putting in a bad url but here's a demo of how I used this feature. I added it to the top of the members viewing page:
DEMO http://www.nineinchnailz.com/forum/members.asp
you also need to check for FORUM_MEMBERS.M_PHOTO_URL<>'http://' because that is the default if no photo url is entered.
Dayve
Edited by - dayve on 04 July 2001 12:53:34
Edited by - dayve on 04 July 2001 12:55:23 |
|
|
GauravBhabu
Advanced Member
4288 Posts |
Posted - 04 July 2001 : 08:15:55
|
Excellent idea. Made a few changes and used the forum variables. Here is the script.
'START MEMBER IN SPOTLITE SCRIPT function MemInSpot set rsMemInSpot = Server.CreateObject("ADODB.Recordset") strSql = "SELECT " & strTablePrefix & "MEMBERS.MEMBER_ID, " & strTablePrefix & "MEMBERS.M_PHOTO_URL, " & strTablePrefix & "MEMBERS.M_NAME, " strSql = strSql & strTablePrefix & "MEMBERS.M_FIRSTNAME, " & strTablePrefix & "MEMBERS.M_LASTNAME, " & strTablePrefix & "MEMBERS.M_AGE" strSql = strSql & " FROM " & strTablePrefix & "MEMBERS" 'strSql = strSql & " WHERE " & strTablePrefix & "MEMBERS.M_PHOTO_URL" <> "" rsMemInSpot.Open strSql, my_Conn,3,,adCmdText Dim intRnd Randomize Timer intRnd = (Int(RND * rsMemInSpot.RecordCount)) rsMemInSpot.Move intRnd Response.Write " <br><tr><td align=center bgcolor=""" & strForumCellColor & """>" & vbCrLf & _ " <font face=""" & strDefaultFontFace & """ color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """>member in spot</font><br><br>" & vbCrLf & _ " <a href=""pop_profile.asp?mode=display&id="& rsMemInSpot("member_id") & """> " & rsMemInSpot("M_NAME") & "</A><br>" & vbCrLf if Trim(rsMemInSpot("M_PHOTO_URL")) <> "" and lcase(rsMemInSpot("M_PHOTO_URL")) <> "http://" then Response.write " <a href=" & ChkString(rsMemInSpot("M_PHOTO_URL"), "display")& ">" & vbCrLf & _ " <img src=" & ChkString(rsMemInSpot("M_PHOTO_URL"), "display")& vbCrLf & _ " alt=" & ChkString(rsMemInSpot("M_NAME"),"display")& vbCrLf & _ " width=""150"" height=""150"" border=""0"" hspace=""0"" vspace=""0""></a><br>" & vbCrLf & _ " <font face=""" & strDefaultFontFace & """ color=""" & strDefaultFontColor & """ size=""" & strFooterFontSize & """>" & vbCrLf & _ " click image for full picture</font>" & vbCrLf else Response.Write " <img src=images/icon_photo_none.gif alt=""no photo available"" width=""100"" height=""100"" border=""0"" hspace=""0"" vspace=""0""><br>" & vbCrLf end if Response.Write " <font face=""" & strDefaultFontface & """ color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """>" & vbCrLf & _ " <br><font face=""" & strDefaultFontface & """ color=""" & strDefaultFontColor & """ size=""" & strFooterFontSize & """><center>click on member name for profile</center></font><BR>" & vbCrLf & _ " </td></tr><br>" rsMemInSpot.Close Set rsMemInSpot = Nothing end function
'END MEMBER IN SPOTLITE SCRIPT
This will show nophoto.gif if no photo is available. Gives an equal opportunity for all members to be picked up to be shown as member in spot.
just a beginning... log in and click on members from the menu to see.
I included the script in my inc_top.asp
gauravbhabu
There is only one miracle...That is LIFE!
Edited by - GauravBhabu on 04 July 2001 09:05:26 |
|
|
concep86
Junior Member
USA
140 Posts |
|
dayve
Forum Moderator
USA
5820 Posts |
Posted - 04 July 2001 : 12:58:26
|
I didn't force both width and height because images would show up really screwed up. I only forced a width so the height would remain proportional. soon I will add an upload feature for members photos like I have for my avatars, that way I can use a server side script for proportionizing the images to a certain ratio. this should be an easy mod..
Dayve |
|
|
bjlt
Senior Member
1144 Posts |
Posted - 04 July 2001 : 22:25:14
|
quote:
I didn't force both width and height because images would show up really screwed up. I only forced a width so the height would remain proportional. soon I will add an upload feature for members photos like I have for my avatars, that way I can use a server side script for proportionizing the images to a certain ratio. this should be an easy mod..
Dayve
can your server side script generate thumnails as well? or a component. thanks.
Edited by - bjlt on 04 July 2001 22:26:40 |
|
|
dayve
Forum Moderator
USA
5820 Posts |
Posted - 05 July 2001 : 10:47:01
|
quote:
quote:
I didn't force both width and height because images would show up really screwed up. I only forced a width so the height would remain proportional. soon I will add an upload feature for members photos like I have for my avatars, that way I can use a server side script for proportionizing the images to a certain ratio. this should be an easy mod..
Dayve
can your server side script generate thumnails as well? or a component. thanks.
Edited by - bjlt on 04 July 2001 22:26:40
I presently have a server side routine to create thumbnails and it is quite easy, all you do is point to a directory full of images. I am going away for 2 weeks on vacation so try to remind me if you need help still before I get back.
Dayve |
|
|
Aznknight
Senior Member
USA
1373 Posts |
Posted - 05 July 2001 : 14:25:12
|
hmm, didn't i post this code awhile back?
a few things concept. you don't need objConnection. i dimmed that because pages outside of my forum had differenct connection than my_Conn because Tuan used objConnection for other parts of the site, hence two connections which you don't really need objConnection since you're doing it by the recordset anyways "rspod.Open query, strConnString, 3, , adCmdText"
Another thing, i'm not sure if this is truely random enough. I don't believe it'll get the records near the end. Not sure if i'm right now. maybe it works.
quote:
Dim intRnd Randomize Timer intRnd = (Int(RND * rspod.RecordCount))
rspod.Move intRnd
- Alan www.iamviet.com www.calvsa.net Snitz Resource |
|
|
concep86
Junior Member
USA
140 Posts |
Posted - 05 July 2001 : 19:54:07
|
Alan, your right to an extent, This is your mostly your code... but for the members online piece you posted...
Like I said... I took no credit for the mod... I just took something and changed it a bit... added a little here and came up with this...
I will look at the code and see what your saying...
I am sure you are right on the money... with your comments..
I will take the comments and try to rework the mod..
Thanks Alan.
Concep86 Webmaster http://www.coneciones.com
|
|
|
RDoGG™
Junior Member
USA
329 Posts |
|
concep86
Junior Member
USA
140 Posts |
Posted - 05 July 2001 : 20:58:01
|
Sorry, This is my development server and I am getting "THE BLUE SCREEN OF DEATH" you'd think Microsoft would have fixed that.... :)
It will be back up in a about an hour or so... I HOPE...
Concep86 Webmaster http://www.coneciones.com
|
|
|
dayve
Forum Moderator
USA
5820 Posts |
Posted - 05 July 2001 : 23:12:37
|
quote:
Another thing, i'm not sure if this is truely random enough. I don't believe it'll get the records near the end. Not sure if i'm right now. maybe it works.
Dim intRnd Randomize Timer intRnd = (Int(RND * rspod.RecordCount))
rspod.Move intRnd
- Alan www.iamviet.com www.calvsa.net Snitz Resource
please elaborate??
Dayve |
|
|
|
Topic |
|