Enough of this muddafakking shit!

Allmänna frågor och info om webbsidan
Silversixx
Inlägg: 1153
Blev medlem: 09 okt 2008, 15:14

Enough of this muddafakking shit!

Inlägg av Silversixx »

Jag börjar bli helt galen och klarar inte av att hålla inne ctrl eller cmd längre!
Compared to phpBB3, links in phpBB2 had a slightly different behaviour: When you clicked them, they opened a new window with the requested page. This was changed in phpBB3 for a couple of reasons, but one of the most important ones was the goal to achieve XHTML 1.0 Strict-validation for the whole board.

If you still want to get the same behaviour on your new phpBB3 board, there are a couple of small modifications have you to make, which this guide should hopefully explain in enough detail.

Modifying auto-detected links

First of all, make auto-detected links (those that you didn't wrap with the url-BBCode) open new windows when getting clicked. Therefor open the includes/functions_content.php and look for following line (which should be around line 592):

Kod: Markera allt

Code:
        $html    = "$whitespace<!-- $tag --><a$class href=\"$url\">$text</a><!-- $tag -->$append";
                


And replace it with following line:

Kod: Markera allt

Code:
        if ($type == MAGIC_URL_EMAIL)
        {
            $html    = "$whitespace<!-- $tag --><a$class href=\"$url\">$text</a><!-- $tag -->$append";    
        }
        else 
        {
            $html    = "$whitespace<!-- $tag --><a$class href=\"$url\" onclick=\"window.open(this.href);return false;\">$text</a><!-- $tag -->$append";
        } 

BBCode URLs

Next open the bbcode.html of your style (if you're using prosilver, this would be the styles/prosilver/template/bbcode.html file) and look for following line:

Kod: Markera allt

Code:
    <!-- BEGIN url --><a href="{URL}" class="postlink">{DESCRIPTION}</a><!-- END url -->

Now replace it with this line:

Kod: Markera allt

Code:
    <!-- BEGIN url --><a href="{URL}" onclick="window.open(this.href);return false;" class="postlink">{DESCRIPTION}</a><!-- END url -->

Help phpBB read the output again

Last but not least, you should also do the following change which will allow the created HTML output to be parsed again by phpBB: Open the includes/functions.php and replace this segment which you should find around line 2740...

Kod: Markera allt

Code:
          case 'bbcode_htm':
             return array(
                '#<!\-\- e \-\-><a href="mailto:(.*?)">.*?</a><!\-\- e \-\->#',
                '#<!\-\- l \-\-><a (?:class="[\w-]+" )?href="(.*?)(?:(&|\?)sid=[0-9a-f]{32})?">.*?</a><!\-\- l \-\->#',
                '#<!\-\- ([mw]) \-\-><a (?:class="[\w-]+" )?href="(.*?)">.*?</a><!\-\- \1 \-\->#',
                '#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/.*? \/><!\-\- s\1 \-\->#',
                '#<!\-\- .*? \-\->#s',
                '#<.*?>#s',
             );

... with this one:

Kod: Markera allt

Code:
          case 'bbcode_htm':
             return array(
                '#<!\-\- e \-\-><a href="mailto:(.*?)">.*?</a><!\-\- e \-\->#',
                '#<!\-\- l \-\-><a (?:class="[\w-]+" )?href="(.*?)(?:(&|\?)sid=[0-9a-f]{32})?" onclick="window\.open\(this\.href\);return false;">.*?</a><!\-\- l \-\->#',
                '#<!\-\- ([mw]) \-\-><a (?:class="[\w-]+" )?href="(.*?)" onclick="window\.open\(this\.href\);return false;">.*?</a><!\-\- \1 \-\->#',
                '#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/.*? \/><!\-\- s\1 \-\->#',
                '#<!\-\- .*? \-\->#s',
                '#<.*?>#s',
             );

And since you've updated also a template file, don't forget to also purge your board's cache through the respective button on the frontpage of your board's admin panel.

Note: The change will not affect existing posts, you must edit them so they can be reprocessed.
http://www.phpbb.com/kb/article/links-o ... w-windows/

Användarvisningsbild
NilssonHarHund
Inlägg: 974
Blev medlem: 09 okt 2008, 00:22

Re: Enough of this muddafakking shit!

Inlägg av NilssonHarHund »

xhtml 1.0 strict ftw!

Du kan säkert ställa in din webbläsare att öppna alla länkar i nya fönster, Fanni. Tvinga inte alla oss andra att stänga massa flikar i onödan.

Silversixx
Inlägg: 1153
Blev medlem: 09 okt 2008, 15:14

Re: Enough of this muddafakking shit!

Inlägg av Silversixx »

NilssonHarHund skrev:xhtml 1.0 strict ftw!

Du kan säkert ställa in din webbläsare att öppna alla länkar i nya fönster, Fanni. Tvinga inte alla oss andra att stänga massa flikar i onödan.
Klart jag kan, men det har inte med saken att göra. Kalla mig konservativ, men jag kräver att forum, av traditionsenliga skäl, ska öppna alla länkar i ett nytt fönster. Eftersom nästan alla har den funktionen per automatik så är det sjukt irriterande att vissa inte följer normen.
Fast iofs, jag skulle sparat min röst till senare idag...

Kalåada!

paintner
Inlägg: 704
Blev medlem: 28 nov 2009, 01:47

Re: Enough of this muddafakking shit!

Inlägg av paintner »

jag öppnar alla länkar med mittmusknappen = öppnar ny tabb ...
vanesak så jag lider inte med dig direkt.

men jag håller nog med dig. en länk i en post man klickar på är täkt att mna ska läsa och sedan gå till posten och svara där. inte backa i history 2-3ggr eller leta upp tråden igen från forumindex =)
- black templars @ time of ending -

Användarvisningsbild
Asplund
Inlägg: 1538
Blev medlem: 27 okt 2008, 13:02
Ort: Bästkusten

Re: Enough of this muddafakking shit!

Inlägg av Asplund »

Är det här nån Mac-grej jag missar?

Silversixx
Inlägg: 1153
Blev medlem: 09 okt 2008, 15:14

Re: Enough of this muddafakking shit!

Inlägg av Silversixx »

Norrland skrev:Är det här nån Mac-grej jag missar?
Nej, det är bara du som ställt av din dator till slacker and ease-mode. Så det kommer aldrig drabba dig...

Användarvisningsbild
Asplund
Inlägg: 1538
Blev medlem: 27 okt 2008, 13:02
Ort: Bästkusten

Re: Enough of this muddafakking shit!

Inlägg av Asplund »

Silversixx skrev:
Norrland skrev:Är det här nån Mac-grej jag missar?
Nej, det är bara du som ställt av din dator till slacker and ease-mode. Så det kommer aldrig drabba dig...
Förlåt, ska genast ställa om den till Incredible-hard-to-work-with mode.

Användarvisningsbild
L3go
Inlägg: 1235
Blev medlem: 11 aug 2010, 07:31

Re: Enough of this muddafakking shit!

Inlägg av L3go »

kom till "phpBB3" innan min blick blev glansig och min hjärna stängde av. :lol:
Division 5.
Captaingallas skrev:Blir det trångt i bokhyllan när svärmen växer kan jag alltid förvara dem på kylskåpet!

Skriv svar