php forum
php mysql forum
php mysql smarty
 
Page 1 of 3 1 2 3 >
Topic Options
#234597 - 01/30/03 08:31 AM Alt tags for preview of thread....?
PhotoPost Offline
Hacker

Registered: 02/03/02
Posts: 989
Has anyone done something simliar to:<br /><br />http://www.eclipseforums.org/forumdisplay.php?s=&forumid=15<br /><br />where the alt tags are set to the first 100 characeters of so of a post to "preview" it before clicking on it?
_________________________
[]http://www.danasoft.com/vipersig.jpg[/]
Viper Alley - http://www.viperalley.com
Extreme Fitness - http://www.extremefitness.com[/b]

Top
#234598 - 01/30/03 12:59 PM Re: Alt tags for preview of thread....? [Re: gailg]
PhotoPost Offline
Hacker

Registered: 02/03/02
Posts: 989
I did it here, pretty easy actually. Just add $Body in postlist.php and then add a title tag to the a href line.<br /><br />I did add something to clean up the $Body (strip_tags and htmlspecialcharacters) and then chopped it off at 100 characters.<br /><br />http://www.viperalley.com/postlist.php?Cat=&Board=offtopic
_________________________
[]http://www.danasoft.com/vipersig.jpg[/]
Viper Alley - http://www.viperalley.com
Extreme Fitness - http://www.extremefitness.com[/b]

Top
#234599 - 01/30/03 03:19 PM Re: Alt tags for preview of thread....? [Re: gailg]
MTO Offline
Addict

Registered: 01/31/00
Posts: 1524
Loc: Burgos, Spain.
Looks great. <img src="/forum/images/graemlins/smile.gif" alt="" /> Can you tell if it slows down the page?
_________________________
Mateo Byler
CruceDeCaminos.com

Top
#234600 - 01/30/03 07:04 PM Re: Alt tags for preview of thread....? [Re: D_Wolfwood]
PhotoPost Offline
Hacker

Registered: 02/03/02
Posts: 989
Not at all - no additional queries are done and it just adds a title tag to the a href link. I only had to add like 5 lines to postlist.php: <br /> <br />[]SELECT t1.B_Number,t1.B_Parent,t1.B_Username,t1.B_Posted,t1.B_Last_Post,t1.B_Last_Number,t1.B_Last_Name,t1.B_Last_Approved,t1.B_Subject,t1.B_Main,t1.B_Status,t1.B_Approved,t1.B_Icon,t1.B_Reged,t1.B_Counter,t1.B_Sticky,t1.B_Replies,t1.B_Rating,t1.B_Rates,t1.B_RealRating,t2.U_Color,t2.U_Status,t1.B_PosterId,t1.B_File,t1.B_Body[/] <br /> <br />[]list($Number,$Parent,$Username,$Posted,$Last_Post,$Last_Number,$Last_Name,$Last_Approved,$Subject,$Main,$Open,$Approved,$icon,$Reged,$Counter,$Sticky,$Replies,$Rating,$Rates,$stars,$Color,$PostStatus,$posterid,$file,$Body) = $dbh -> fetch_array($sth); <br /> <br /> // ------------------------- <br /> // Standard icon is the note <br /> if (!$icon) { <br /> $icon = "book.gif"; <br /> } <br /> <br /> $Body = strip_tags($Body); <br /> $Body = htmlspecialchars($Body); <br /> if ( strlen($Body) > 100 ) { <br /> $Body = substr($Body, 0, 100); <br /> $Body .= " ..."; <br /> }[/] <br /> <br />down a bit where $postlist is being set, add this above the line that sets $Subject: <br /> <br />[]$postrow[$i]['Body'] = $Body; [/] <br />then this to postlist.thtml: <br /> <br />[]<a href="{$config['phpurl']}/$mode.php?Cat=$Cat&amp;Board=$Board&amp;Number={$postrow[$i]['Number']}&amp;page=$page&amp;view=$view&amp;sb=$sb&amp;o=$o&amp;fpart={$postrow[$i]['fpart']}{$postrow[$i]['jumper']}" title="{$postrow[$i]['Body']}">[/]
_________________________
[]http://www.danasoft.com/vipersig.jpg[/]
Viper Alley - http://www.viperalley.com
Extreme Fitness - http://www.extremefitness.com[/b]

Top
#234601 - 01/30/03 07:52 PM Re: Alt tags for preview of thread....? [Re: gailg]
MTO Offline
Addict

Registered: 01/31/00
Posts: 1524
Loc: Burgos, Spain.
Cool! Does it grab the body of the first post? Or the first unread post? It's really cool anyhow it be. <img src="/forum/images/graemlins/applause.gif" alt="" />
_________________________
Mateo Byler
CruceDeCaminos.com

Top
#234602 - 01/30/03 08:21 PM Re: Alt tags for preview of thread....? [Re: D_Wolfwood]
omegatron Offline
Member

Registered: 04/05/01
Posts: 3440
Loc: abingdon,md
Okay we sure there is not a step missing <img src="/forum/images/graemlins/wink.gif" alt="" /><br /><br />I did these simple couple lines and I get no box that comes up when I mouse over them like I see on the example forum.<br /><br />I double checked my copy and paste hacking. <img src="/forum/images/graemlins/smile.gif" alt="" /> Everything was copied right.
_________________________
Chuck S

DIVE IN AND VISIT ME:

Omegatron\'s Reefs

Administrator at ReefTalk

Top
#234603 - 01/30/03 08:27 PM Re: Alt tags for preview of thread....? [Re: sf49rminer]
PhotoPost Offline
Hacker

Registered: 02/03/02
Posts: 989
Oh, yes, one more thing.... Down below where the $postrow gets setup; above the $Subject, put this:<br /><br />$postrow[$i]['Body'] = $Body;
_________________________
[]http://www.danasoft.com/vipersig.jpg[/]
Viper Alley - http://www.viperalley.com
Extreme Fitness - http://www.extremefitness.com[/b]

Top
#234604 - 01/30/03 09:02 PM Re: Alt tags for preview of thread....? [Re: gailg]
omegatron Offline
Member

Registered: 04/05/01
Posts: 3440
Loc: abingdon,md
I seem to be the one who finds the missing parts <img src="/forum/images/graemlins/wink.gif" alt="" /> <br /> <br />Thanx Michaels works very well now.
_________________________
Chuck S

DIVE IN AND VISIT ME:

Omegatron\'s Reefs

Administrator at ReefTalk

Top
#234605 - 02/03/03 06:43 PM Re: Alt tags for preview of thread....? [Re: sf49rminer]
cstaber Offline
Journeyman

Registered: 08/17/02
Posts: 124
Loc: Tampa, FL
haha wow, that's too cool <img src="/forum/images/graemlins/cool.gif" alt="" />

Top
#234606 - 02/04/03 07:36 AM Re: Alt tags for preview of thread....? [Re: ]
smilesforu Offline
Junior Member

Registered: 01/31/02
Posts: 676
Very Cool!!<br />This coming out as a finished mod? Seems pretty basic but could use some documentation.<br /><br />For idiots like myself <img src="/forum/images/graemlins/smile.gif" alt="" />

Top
#234607 - 02/05/03 05:16 AM Re: Alt tags for preview of thread....? [Re: gailg]
smilesforu Offline
Junior Member

Registered: 01/31/02
Posts: 676
Ok got it working.. took me a bit to catch the bold changes <br /><br />This is a cool one for sure!!<br />TY TY TY

Top
#234608 - 02/05/03 05:37 AM Re: Alt tags for preview of thread....? [Re: gailg]
smilesforu Offline
Junior Member

Registered: 01/31/02
Posts: 676
This only works properly in flat mode... when it expanded mode it translates the tags to the wrong threads. still like the hack but a fix? or did I miss something

Top
#234609 - 02/05/03 06:03 AM Re: Alt tags for preview of thread....? [Re: Kelly]
omegatron Offline
Member

Registered: 04/05/01
Posts: 3440
Loc: abingdon,md
flat mod threaded mod. No such animal here. This is the postlist screen <img src="/forum/images/graemlins/wink.gif" alt="" /><br /><br />This is not designed to work on replies. (expanded mod)<br />It will work for about two and break. <img src="/forum/images/graemlins/frown.gif" alt="" /><br /><br />I will look into it and see what I can come up with but all in all Michael did a great job. Quite a small mod but very useful and teasing.
_________________________
Chuck S

DIVE IN AND VISIT ME:

Omegatron\'s Reefs

Administrator at ReefTalk

Top
#234610 - 02/07/03 10:02 AM Re: Alt tags for preview of thread....? [Re: gailg]
JustDave Offline
That 70's Guy

Registered: 06/24/01
Posts: 4097
I added this alt text code to the search area here while adding another modification. Hope you don't mind. <img src="/forum/images/graemlins/smile.gif" alt="" />
_________________________
~Dave
ChattersOnline.com

Top
#234611 - 02/07/03 10:51 AM Re: Alt tags for preview of thread....? [Re: sjsaunders]
Dave_L_dup1 Offline
Addict

Registered: 04/23/02
Posts: 1929
Loc: Virginia, USA
Slightly off-topic, but is there any limit to the length of the alt or title text?
_________________________
UBB.threads beta tester / threadsdev.com moderator
Software consulting services including UBB.threads problem resolution / installs / upgrades / customization.

Top
#234612 - 02/07/03 11:12 AM Re: Alt tags for preview of thread....? [Re: joeuser]
JustDave Offline
That 70's Guy

Registered: 06/24/01
Posts: 4097
I looked around w3c.org briefly and didn't find any specific references to the length.<br /><br />Just playing around I believe I got over a 1000 characters into it. (IE 6.0)
_________________________
~Dave
ChattersOnline.com

Top
#234613 - 02/07/03 11:57 AM Re: Alt tags for preview of thread....? [Re: gailg]
JustDave Offline
That 70's Guy

Registered: 06/24/01
Posts: 4097
I added to the code a bit. I replaced the <br /> tags with new line characters \n before stripping the html so that the tool tip/title display looked more like the actual post. <img src="/forum/images/graemlins/smile.gif" alt="" /><br /><br />
Code:
<br />		$Body = str_replace("&lt;br /&gt;","\n",$Body);	<br />		$Body = strip_tags($Body); <br />		$Body = htmlspecialchars($Body); <br />		if ( strlen($Body) &gt; 150 ) { <br />			$Body = substr($Body, 0, 150); <br />			$Body .= " ..."; <br />		}<br />
<br /><br />
_________________________
~Dave
ChattersOnline.com

Top
#234614 - 02/07/03 03:35 PM Re: Alt tags for preview of thread....? [Re: sjsaunders]
JustDave Offline
That 70's Guy

Registered: 06/24/01
Posts: 4097
Scratch that. Only IE seems to be able to use the new line characters. Mozilla/Netscape and Opera do not. <img src="/forum/images/graemlins/crazy.gif" alt="" />
_________________________
~Dave
ChattersOnline.com

Top
#234615 - 02/07/03 03:37 PM Re: Alt tags for preview of thread....? [Re: joeuser]
JustDave Offline
That 70's Guy

Registered: 06/24/01
Posts: 4097
Dave_L the size of the "tool tip" varried between IE/Mozilla/Opera. IE was able to display the most.
_________________________
~Dave
ChattersOnline.com

Top
#234616 - 02/07/03 06:27 PM Re: Alt tags for preview of thread....? [Re: sjsaunders]
Dave_L_dup1 Offline
Addict

Registered: 04/23/02
Posts: 1929
Loc: Virginia, USA
Thanks, I was just curious. I'm working on something that may put a lot of text there, and I was wondering if there were any sort of specified limit.
_________________________
UBB.threads beta tester / threadsdev.com moderator
Software consulting services including UBB.threads problem resolution / installs / upgrades / customization.

Top
Page 1 of 3 1 2 3 >


Moderator:  Gizmo 
Who's Online
0 registered (), 24 Guests and 9 Spiders online.
Key: Admin, Global Mod, Mod
Shout Box

Latest Posts
Spell Check [beta]
by Bill B
48 minutes 24 seconds ago
PhotoPost BB Code Popup
by AllenAyres
Today at 09:41 AM
Problems reading a lot of old posts here
by AllenAyres
Today at 09:35 AM
Forum 'Trader Ratings'.
by AllenAyres
Today at 09:33 AM
Customization needed
by Gizmo
11/12/08 12:28 PM
Team UBBDev Rides Again!
by AllenAyres
11/11/08 02:16 PM
Active Topics.
by AllenAyres
11/11/08 02:13 PM
New Mods
User Authentication Class
by
01/19/07 02:59 PM
Multiple Identity Detector
by
12/30/06 06:39 PM
PhotoPost BB Code Popup
by
11/06/06 05:43 PM
Spell Check [beta]
by
10/17/06 09:24 PM
Newest Members
David DelMonte, nick1, Begbie, cenk, MATTO
13363 Registered Users
Top Posters
AllenAyres 25452
JoshPet 11330
Rick 8372
LK 7396
Lord Dexter 6503
Greg Hard 5533
Charles Capps 5438

 

 

 
fusionbb message board php hacks