Short URLs (WBB Style) for PHPBB 2.0.x

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Cobra85
Registered User
Posts: 6
Joined: Fri Aug 22, 2003 7:39 pm

Short URLs (WBB Style) for PHPBB 2.0.x

Post by Cobra85 »

This MOD replaces all URL longer than 55 Characters to smaller ones as long as you do not use any styles because otherwise it would destroy them.

Example:
http://yourdomain.com/yourfolder/nextfo ... ument.html
to
http://yourdomain.com/yourfolder/nextfo...ument.html

Maybe its interesting for some of you :D

Code: Select all

open /includes/bbcode.php
find 
	return($ret);

add before:
	$ret = preg_replace("/<a href=(.*?)>(.*?)<\/a>/ie", "(strlen(\"\\2\") > 55 && !eregi(\"<\", \"\\2\") ) ? '<a href='.stripslashes(\"\\1\").'>'.substr(\"\\2\", 0, 39) . '...' . substr(\"\\2\", -10).'</a>' : '<a href='.stripslashes(\"\\1\").'>'.\"\\2\".'</a>'", $ret);

Save and upload file - DONE
Have fun with this one :wink:
kkks
Registered User
Posts: 50
Joined: Mon Jul 08, 2002 3:48 am
Location: Auckland, New Zealand
Contact:

Post by kkks »

Thanks, it's a good one.
SillyDog701: Netscape Browser Archive | Browser Version Guide | Message Centre | MacCentre701
MozInfo - Mozilla Information Centre
Tecnoman®
Registered User
Posts: 1
Joined: Wed Oct 29, 2003 1:59 pm

Re: Short URLs (WBB Style) for PHPBB 2.0.x

Post by Tecnoman® »

Cobra85 wrote: This MOD replaces all URL longer than 55 Characters to smaller ones as long as you do not use any styles because otherwise it would destroy them.

Example:
http://yourdomain.com/yourfolder/nextfo ... ument.html
to
http://yourdomain.com/yourfolder/nextfo...ument.html

Maybe its interesting for some of you :D

Code: Select all

open /includes/bbcode.php
find 
	return($ret);

add before:
	$ret = preg_replace("/<a href=(.*?)>(.*?)<\/a>/ie", "(strlen(\"\\2\") > 55 && !eregi(\"<\", \"\\2\") ) ? '<a href='.stripslashes(\"\\1\").'>'.substr(\"\\2\", 0, 39) . '...' . substr(\"\\2\", -10).'</a>' : '<a href='.stripslashes(\"\\1\").'>'.\"\\2\".'</a>'", $ret);

Save and upload file - DONE
Have fun with this one :wink:
thx man very good mod
DonkeyTron
Registered User
Posts: 56
Joined: Thu Dec 12, 2002 5:18 pm
Location: England

Post by DonkeyTron »

Found a problem.

A member posted this :

Code: Select all

http://members.cox.net/impunity/endofworld.swf
But it showed as this :

Code: Select all

http://members.cox.net/impunity/endofwo...fworld.swf
:?:
Jackal05
Registered User
Posts: 24
Joined: Mon Oct 27, 2003 2:30 am
Location: Nowhere of nowhere
Contact:

Post by Jackal05 »

Well it is a bit buggy but it's good.
By the way put [BETA] before the subject.
DoD999
Registered User
Posts: 122
Joined: Tue Aug 05, 2003 2:29 am
Location: Birmingham UK
Contact:

Post by DoD999 »

You should set it so if its 58 chatachters or longer, it will do what you say.

Since you have 3 charachters for the ..., so its pointless replacing 0,1,2 or 3 charchters with another 3.

Really, i think it should be a if length of string > 60... do stuff...
User avatar
smithy_dll
Former Team Member
Posts: 7630
Joined: Tue Jan 08, 2002 6:27 am
Location: Australia
Name: Lachlan Smith
Contact:

Post by smithy_dll »

Whack it into the MOD Template and send it our way to validate

http://www.phpbb.com/kb/article.php?article_id=39

http://www.phpbb.com/mods/
Systems Engineering
loopmaster
Registered User
Posts: 43
Joined: Tue Mar 12, 2002 4:26 pm
Location: England
Contact:

Post by loopmaster »

Doesn't seem to work in 2.0.6, despite following the instructions.

Code: Select all

Fatal error: Call to undefined function: make_clickable() in /sites/emuunlim.com/cp-systems2turbo/phpbb/viewtopic.php on line 1080
Enjoy a sun filled tropical holiday at http://www.ojko.com/phpbb/ home of the official FinalBurn Alpha forums. FinalBurn Alpha is an emulator for MC68000/Z80 based arcade games.
loopmaster
Registered User
Posts: 43
Joined: Tue Mar 12, 2002 4:26 pm
Location: England
Contact:

Post by loopmaster »

Scratch that, it was a dumb error on my part. 8O

It works fine, see this url for an example: http://cp-systems2turbo.emuunlim.com/ph ... 2402#12402
Enjoy a sun filled tropical holiday at http://www.ojko.com/phpbb/ home of the official FinalBurn Alpha forums. FinalBurn Alpha is an emulator for MC68000/Z80 based arcade games.
WelcomB
Registered User
Posts: 154
Joined: Fri Dec 26, 2003 4:23 pm

Post by WelcomB »

You know what would be even cooler? It would be to place the ... between slashes such that the final document could be seen and it looks nice.

Example:
http://yourdomain.com/yourfolder/nextfo ... ument.html
could become
http://yourdomain.com/yourfolder/.../document.html
Check out my mod: Pop-up Announcement
I see in your eyes the same fear that would take the heart of me. A day may come when the courage of Men fail, when we forsake our friends, and break all bonds of fellowship, but it is not this day. This day, we fight!!!
epolady
Registered User
Posts: 109
Joined: Mon Aug 12, 2002 1:33 am

Post by epolady »

Hi, I'm having a problem with this one. It sorts them fine when just posting the URL, but when I do something like

Code: Select all

[url=http://www.phpBB.com]phpBB's the best![/url]
It shows up like "phpBB\'s the best!"

Any clues?
whoo
Registered User
Posts: 575
Joined: Fri Mar 07, 2003 4:12 am

Post by whoo »

double post sorry
Last edited by whoo on Fri Feb 20, 2004 7:28 pm, edited 1 time in total.
whoo
Registered User
Posts: 575
Joined: Fri Mar 07, 2003 4:12 am

Post by whoo »

nm
FX
Registered User
Posts: 254
Joined: Thu Aug 01, 2002 9:29 pm
Location: France
Contact:

Post by FX »

Did you have fixed the bug ?
niekas
Registered User
Posts: 562
Joined: Sun Sep 23, 2001 7:34 am

Post by niekas »

FX wrote: Did you have fixed the bug ?


thanks for the mod, Cobra85.


The slashes bug fix:

Code: Select all

	$ret = preg_replace("/<a href=(.*?)>(.*?)<\/a>/ie", "(strlen(\"\\2\") > 55 && !eregi(\"<\", \"\\2\") ) ? '<a href='.stripslashes(\"\\1\").'>'.substr(\"\\2\", 0, 39) . '...' . substr(\"\\2\", -10).'</a>' : '<a href='.stripslashes(\"\\1\").'>'.stripslashes(\"\\2\").'</a>'", $ret);
Locked

Return to “[2.0.x] MODs in Development”