adding a title to all the links of new topics....

Got a question about Melbourne Beats? Got some feedback or suggestions for us? Post a message here.
Post Reply
User avatar
saintberry
Posts: 1259
Joined: Mon Mar 07, 2005 2:17 pm

adding a title to all the links of new topics....

Post by saintberry »

ok one thing that i think would be a handy to add to this site would be a small title in the link of a topic in the forum. the title would comprise of about 20 to 50 words of the first post in the thread.

it would be fuck easy to do...infact wait a tick

Code: Select all

// function to limit a string length...

function wordLimit($string, $length = 50, $ellipsis = '...') {
   return count($words = preg_split('/\s+/', ltrim($string), $length + 1)) > $length ?
       rtrim(substr($string, 0, strlen($string) - strlen(end($words)))) . $ellipsis :
       $string;
}



// that needs to go in the page you are displaying the links...just put it in a file and then...

  include("wordlimit.php");



/* you will need a var for the first post of the thread (i bet one is already set).
then when you are pulling all the threads from the db its a simple matter of...*/

 <a href="threads.php" title="<?php echo wordLimit($firstPost, 20); ?>">title of thread</a>
that would make peoples life of deciding what thread is worth viewing a lot easier – as they wouldnt even have to open the thread to get an idea of what is in it.. just an idea :)


EDIT: its kinda like the alt tag for an image and how that displays using IE (even tho thats not what they are designed to do but anyway). it wont change the way anything looks. just if you hover your mouse over a link it will display the text. should work in all decent browsers.
First you get her name. Then you get her number. Then you get some get some in the back seat of a hummer!
User avatar
valuetime
Posts: 2893
Joined: Thu Nov 25, 2004 1:34 am
Location: Melbourne
Contact:

Post by valuetime »

yeah, i've been barking up this tree for a while, but never knew the code.

it used to save me a bunch of page views on mj.
User avatar
Lós Kasino—
Posts: 3721
Joined: Thu Nov 25, 2004 2:04 am
Location: Brooklyn, NYC

Post by Lós Kasino— »

omg are u that lazy u cant even click your mouse button just once !



:roll:
Post Reply