Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Joined: Feb 2002
Posts: 950
Hacker
Hacker
Offline
Joined: Feb 2002
Posts: 950
Has anyone done something simliar to:

http://www.eclipseforums.org/forumdisplay.php?s=&forumid=15

where the alt tags are set to the first 100 characeters of so of a post to "preview" it before clicking on it?

Sponsored Links
Joined: Feb 2002
Posts: 950
Hacker
Hacker
Offline
Joined: Feb 2002
Posts: 950
I did it here, pretty easy actually. Just add $Body in postlist.php and then add a title tag to the a href line.

I did add something to clean up the $Body (strip_tags and htmlspecialcharacters) and then chopped it off at 100 characters.

http://www.viperalley.com/postlist.php?Cat=&Board=offtopic

Joined: Jan 2000
Posts: 796
MTO Offline
Addict
Addict
Offline
Joined: Jan 2000
Posts: 796
Looks great. Can you tell if it slows down the page?

Joined: Feb 2002
Posts: 950
Hacker
Hacker
Offline
Joined: Feb 2002
Posts: 950
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:

[]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[/]

[]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);

// -------------------------
// Standard icon is the note
if (!$icon) {
$icon = "book.gif";
}

$Body = strip_tags($Body);
$Body = htmlspecialchars($Body);
if ( strlen($Body) > 100 ) {
$Body = substr($Body, 0, 100);
$Body .= " ...";
}
[/]

down a bit where $postlist is being set, add this above the line that sets $Subject:

[]$postrow[$i]['Body'] = $Body; [/]
then this to postlist.thtml:

[]<a href="{$config['phpurl']}/$mode.php?Cat=$Cat&Board=$Board&Number={$postrow[$i]['Number']}&page=$page&view=$view&sb=$sb&o=$o&fpart={$postrow[$i]['fpart']}{$postrow[$i]['jumper']}" title="{$postrow[$i]['Body']}">[/]

Joined: Jan 2000
Posts: 796
MTO Offline
Addict
Addict
Offline
Joined: Jan 2000
Posts: 796
Cool! Does it grab the body of the first post? Or the first unread post? It's really cool anyhow it be.

Sponsored Links
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Okay we sure there is not a step missing

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.

I double checked my copy and paste hacking. Everything was copied right.

Joined: Feb 2002
Posts: 950
Hacker
Hacker
Offline
Joined: Feb 2002
Posts: 950
Oh, yes, one more thing.... Down below where the $postrow gets setup; above the $Subject, put this:

$postrow[$i]['Body'] = $Body;

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
I seem to be the one who finds the missing parts

Thanx Michaels works very well now.

Joined: Aug 2002
Posts: 109
Journeyman
Journeyman
Offline
Joined: Aug 2002
Posts: 109
haha wow, that's too cool

Joined: Jan 2002
Posts: 674
Junior Member
Junior Member
Offline
Joined: Jan 2002
Posts: 674
Very Cool!!
This coming out as a finished mod? Seems pretty basic but could use some documentation.

For idiots like myself

Sponsored Links
Joined: Jan 2002
Posts: 674
Junior Member
Junior Member
Offline
Joined: Jan 2002
Posts: 674
Ok got it working.. took me a bit to catch the bold changes

This is a cool one for sure!!
TY TY TY

Joined: Jan 2002
Posts: 674
Junior Member
Junior Member
Offline
Joined: Jan 2002
Posts: 674
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

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
flat mod threaded mod. No such animal here. This is the postlist screen

This is not designed to work on replies. (expanded mod)
It will work for about two and break.

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.

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
I added this alt text code to the search area here while adding another modification. Hope you don't mind.

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
Slightly off-topic, but is there any limit to the length of the alt or title text?

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
I looked around w3c.org briefly and didn't find any specific references to the length.

Just playing around I believe I got over a 1000 characters into it. (IE 6.0)

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
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.

Code
<br />		$Body = str_replace("<br />","\n",$Body);	<br />		$Body = strip_tags($Body); <br />		$Body = htmlspecialchars($Body); <br />		if ( strlen($Body) > 150 ) { <br />			$Body = substr($Body, 0, 150); <br />			$Body .= " ..."; <br />		}<br />



Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
Scratch that. Only IE seems to be able to use the new line characters. Mozilla/Netscape and Opera do not.

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
Dave_L the size of the "tool tip" varried between IE/Mozilla/Opera. IE was able to display the most.

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
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.

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
It seems about a 100 max or so for Opera/Mozilla.

Joined: Apr 2002
Posts: 1,768
Addict
Addict
Offline
Joined: Apr 2002
Posts: 1,768
Thanks

Joined: Mar 2002
Posts: 305
Enthusiast
Enthusiast
Offline
Joined: Mar 2002
Posts: 305
[]Just playing around I believe I got over a 1000 characters into it. (IE 6.0) [/]


I believe the limit is 1036 (though I can't remember where I saw that now! ). Of course that doesn't necessarily mean a browser will display 1036 though, as you've found out. (oops, it's 1024)

Last edited by Lisa_P; 02/08/2003 1:47 AM.

[:"red"]Lisa[/]
Joined: Mar 2002
Posts: 305
Enthusiast
Enthusiast
Offline
Joined: Mar 2002
Posts: 305
[]I looked around w3c.org briefly and didn't find any specific references to the length.

Just playing around I believe I got over a 1000 characters into it. (IE 6.0) [/]

Ah ha! (Trying to find it was driving me nuts )

from w3c: The preliminaries are taken from the HTML DTD and declares the character set as Latin-1, disables markup minimisation and sets limits for tag/attribute names to 34 characters, and attribute values to a maximum of 1024 characters.

I was off by 12.


[:"red"]Lisa[/]
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Go Lisa!

Joined: Dec 2002
Posts: 173
Member
Member
Offline
Joined: Dec 2002
Posts: 173
Hi extremebikini

[] down a bit where $postlist is being set, add this above the line that sets $Subject:



Quote:
--------------------------------------------------------------------------------

$postrow[$i]['Body'] = $Body;

[/]

I have looked for 2 hrs now and can for the life of me find the place to add the above ....

down a bit....how long is your string.......

can't you do it like the other parts and put in the addition in bold

Has anyone out there guessed where this goes, if so could you let us in on the secret....:)

I apologise for my thickness but I don't want to %^%$^%$ up my site with trial and error with one line.

Could it be this bit which is a long long way down?
// Setup the postrow array
$postrow[$z]['color'] = $rowcolor;
$postrow[$z]['indentsize'] = "0";
$postrow[$z]['icon'] = $icon;
$postrow[$z]['imagesize'] = $imagesize;
$postrow[$z]['Number'] = $Number;
$postrow[$z]['Subject'] = $Subject;

Thanks


Thanks

Liahona
Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
LoL you must have some great study habits Lisa!

I didn't spend to much time scanning their site. I do recommend it to those that can't sleep though... LoL

Thanks for finding the specs!

Joined: Dec 2002
Posts: 173
Member
Member
Offline
Joined: Dec 2002
Posts: 173
Hi anybody that's got this working

I still can't get this to work, can anyone explain more what has to be done, as I think I have got lost somewhere on the lines..........

1.....
down a bit where [:"red"] $postlist [/] is being set, add this above the line that sets $Subject:

$postrow[$i]['Body'] = $Body;

And this.............................

2.......
Oh, yes, one more thing.... Down below where the [:"red"] $postrow [/] gets setup; above the $Subject, put this:

$postrow[$i]['Body'] = $Body;

Are these the same and if so where do they go???
and if not then where do they both go???


Also I take it ....this

"then this to postlist.thtml"

should read .......this

"then this to postlist.tmpl"

Last edited by Liahona; 02/13/2003 1:17 PM.

Thanks

Liahona
Joined: Dec 2002
Posts: 173
Member
Member
Offline
Joined: Dec 2002
Posts: 173
Hi

To late

Done it


Thanks

Liahona
Joined: Aug 2002
Posts: 1,191
Kahuna
Kahuna
Joined: Aug 2002
Posts: 1,191
At least you gave it a try and it worked out in the end. I personally like it when that happens. It gives me more satisfaction.

Sorry that I was late George


Nikos
Joined: Dec 2002
Posts: 173
Member
Member
Offline
Joined: Dec 2002
Posts: 173
Thanks anyway Nikos



Thanks

Liahona
Joined: Jan 2002
Posts: 674
Junior Member
Junior Member
Offline
Joined: Jan 2002
Posts: 674
Any luck with (expanded mod)?

Joined: Jan 2002
Posts: 674
Junior Member
Junior Member
Offline
Joined: Jan 2002
Posts: 674
Oh boy... replaced one of my files with a original. Whoops..

Now I can't get this one working again. I look forward to some better documentation on this one. Will try again tonight if nobody gets to this one. Perhaps the adjustments to the search page could be added too. Thanks for all the hard work and creativity.

Joined: Jan 2002
Posts: 674
Junior Member
Junior Member
Offline
Joined: Jan 2002
Posts: 674
I installed YASM and it put the alt tags in the search.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
SmilesforU,

The way this hack is designed it will work for expanded view or flat. However the way its coded the default number of entries that this handles is your postlist default each user or the board has as a default. If you have it set to 20 posts on the postlist screen it will do 20 at a time. So the problem is when you go to expanded it will do the first 20 then stop. So it is not a bug when you switch to expanded.

Maybe one of the guru's can think of a better way to get more but like extremebikini said this is a quick and dirty hack that does exactly what it was designed to do.

Joined: Jan 2002
Posts: 674
Junior Member
Junior Member
Offline
Joined: Jan 2002
Posts: 674
thanks Chuck... I just need to get it working again.

Having trouble finding the right lines to insert... ugh

Joined: Jan 2002
Posts: 674
Junior Member
Junior Member
Offline
Joined: Jan 2002
Posts: 674
(Scripts Removed)

Last edited by JoshPet; 02/17/2003 2:26 AM.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Sorry, we can't post whole threads scripts here on the board as they are copyrighted.

Joined: Jan 2002
Posts: 674
Junior Member
Junior Member
Offline
Joined: Jan 2002
Posts: 674
my bad sorry..

Joined: Aug 2002
Posts: 239
Member
Member
Joined: Aug 2002
Posts: 239
Has anyone written anything about this so dummies like me can install it??


Some people read their stars..... I choose to write my own
Page 1 of 2 1 2

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Shock Hosting
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
AllenAyres
AllenAyres
Texas
Posts: 21,080
Joined: March 2000
Forum Statistics
Forums63
Topics37,583
Posts293,955
Members13,824
Most Online151,614
Nov 14th, 2025
Today's Statistics
Currently Online 701
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 13
Top Posters
AllenAyres 21,080
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,834
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2026 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.1.0
(Snapshot build 20260108)