PDA

View Full Version : vB's automatic link trimming - how to modify?


MrNase
01-27-2005, 03:57 PM
Hello,

Here's what Iam trying to do:

My bb is located at pagodentreff.de/diskussionsforum/ and the url is pretty long.

The urls gets trimmed but that doesn't look that nice as you can see here:

http://www.pagodentreff.de/diskussionsforum/showpost.php?p=2966&postcount=3


I want to have it so that the links look like:

www.pagodentreff.de/.../t311-rueckleuchten-sl-230.html (http://www.pagodentreff.de/.../t311-rueckleuchten-sl-230.html)

instead of

http://www.pagodentreff.de/diskussi...ten-sl-230.html (http://www.pagodentreff.de/diskussionsforum/t311-rueckleuchten-sl-230.html)


How can I affect the function so that I can do a str_replace? What function is responsible for that trimming?


Thanks for any reply :)

MrNase
04-08-2005, 03:28 PM
Let me bump that thread ;)

Marco van Herwaarden
04-08-2005, 06:49 PM
Open includes/functions_bbcodeparse.php

Find:
$text = htmlspecialchars_uni(substr($tmp, 0, 35) . '...' . substr($tmp, -15));Replace by: $text = htmlspecialchars_uni(substr($tmp, 0, 50 - strlen(basename($tmp))) . '.../' . basename($tmp));

Marco van Herwaarden
04-08-2005, 06:50 PM
Could be improved (filename longer then 50 positions for example or always show domain and filename and trim what is in between).

MrNase
04-10-2005, 10:13 AM
Thanks for your answer :)

Here's what your code now produces:

http://www. pagodentreff.de/diskussionsforum/t939-nip.../t939-nippel-day--2005--.html

Marco van Herwaarden
04-10-2005, 04:19 PM
Complete with the space after www. ??

It is now how you want or not? Like i said it is just a start.

MrNase
04-12-2005, 06:42 AM
No, not with the space. I had to add it because vB likes trimming the links so much so my link would have got messed up ;)

The problem is: this little function adds the last section of the url twice as you can see on the example.

Anyway, thanks for your help. It does look better now but I will take a deeper look at it :)

Marco van Herwaarden
04-12-2005, 07:03 AM
Then you must have changed something more, because this one is working fine on my testboard:
http://www.pagodentref.../t939-nippel-day--2005--.htmlBut as you can see the domain name is also cut off, so maybe you could change it a bit to avoid that.

7casas
04-13-2005, 10:24 AM
Hi, it's possible to change the link from the post's title or the category to get something like:
www.mystite.com/VB_hacks
and not:
www.mysite.com/showthread.php?...