how can i disable the links in text body ?

Discussions about the phpBB2 Forum. How to get the best from this powerful script.

Moderator: Moderators

how can i disable the links in text body ?

Postby AmirAbbas » Wed Nov 29, 2006 1:23 pm

how can i disable the links in text body

hi

another question :)

how can i disable the link in text body. for example when i type this:

http://www.phpbb-seo.com/boards/seo-tec ... -vt30.html

the phpbb will recognize it as a link. we know that part of text is not wrapped
by [url][/url] but that text will change to a link. how can i disable this feature.
i want only the text between [url][/url] recognized as a link.
i want to know that is possible to show this sort of links :

http://www.phpbb-seo.com/boards/seo-tec ... -vt30.html

in this shape

htxp://www.phpbb-seo.com/boards/seo-techniques/locking-the-www-in-urls-vt30.html

(put text in <b> tag istead of <a> tag or put it in a styled span tag )

?

i think with this trick i can control the amount of external link in my forum
users are very careless about putting dash before URLs :cry:
SEO chat forum are using this method.
User avatar
AmirAbbas
phpBB SEO Team
phpBB SEO Team
 
Posts: 534
Joined: Thu May 11, 2006 3:30 pm
Location: IRAN

Advertisement

Postby dcz » Wed Nov 29, 2006 11:33 pm

The link is made active in phpBB post in viewtopic, using the make_clickable() phpBB function.

Look for :

Code: Select all
   $message = make_clickable($message);


As you see, just one line above there is :

Code: Select all
   if ( $user_sig != '' )
   {
      $user_sig = make_clickable($user_sig);
   }


Wich is as well turning URLs into active links but in the signature this time.

Let's do this nicely.

Open :

viewtopic.php

Find :
Code: Select all
   if ( $user_sig != '' )
   {
      $user_sig = make_clickable($user_sig);
   }
   $message = make_clickable($message);


replace with :

Code: Select all
   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   // Set here the limit before links are active
   // 0 for never
   $min_posts = 25;
   if (intval($postrow[$i]['user_posts']) > $min_posts ) {
   if ( $user_sig != '' )
   {
      $user_sig = make_clickable($user_sig);
   }
   $message = make_clickable($message);
   }
   // www.phpBB-SEO.com SEO TOOLKIT END


This way, the links becomes active once the user has reach a certain amount of posts, set up on this line :

Code: Select all
   $min_posts = 25;



The bold thing need some changes in make_clickable(), tell me if you really want it ;)

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Postby AmirAbbas » Thu Nov 30, 2006 4:48 am

thanks a lot :o

dcz wrote:The bold thing need some changes in make_clickable(), tell me if you really want it :wink:


i need it. could you tell me how can i put link text in bold tag or styled span ? :P
User avatar
AmirAbbas
phpBB SEO Team
phpBB SEO Team
 
Posts: 534
Joined: Thu May 11, 2006 3:30 pm
Location: IRAN

Postby AmirAbbas » Sat Dec 02, 2006 1:05 pm

hi

i think you forgot this topic
User avatar
AmirAbbas
phpBB SEO Team
phpBB SEO Team
 
Posts: 534
Joined: Thu May 11, 2006 3:30 pm
Location: IRAN

Postby dcz » Sun Dec 03, 2006 12:00 pm

No I did not, but this is a real mod you're asking for here, not a simple tweak.

I'll take a look at it, I promise ;)

Could you search a bit at phpBB.com and phpbbhacks.com to see if such mod does not already exists ?

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Postby dcz » Sun Dec 03, 2006 4:46 pm

All right, finally, I came up with a simple one ;)

Open :

Code: Select all
viewtopic.php


find :
Code: Select all
   if ( $user_sig != '' )
   {
      $user_sig = make_clickable($user_sig);
   }
   $message = make_clickable($message);


Replace with :
Code: Select all
   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   // Set here the limit before links are active
   // 0 for never
   $min_posts = 25;
   if (intval($postrow[$i]['user_posts']) > $min_posts ) {
      if ( $user_sig != '' ) {
         $user_sig = make_clickable($user_sig);
      }
      $message = make_clickable($message);
   } else {
      if ( $user_sig != '' ) {
         $user_sig = make_boldlink($user_sig);
      }
      $message = make_boldlink($message);
   }
   // www.phpBB-SEO.com SEO TOOLKIT END


Open :
Code: Select all
includes/bbcode.php



Find :
Code: Select all
   // Remove our padding..
   $ret = substr($ret, 1);

   return($ret);
}


After add :

Code: Select all
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
/**
* Will do the same matchings as make_clickable() but will add bold
* instead of href tags.
* email will be outputed bolds and inactive too : email-AT-domain.com
*/
function make_boldlink($text)
{
   $text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text);

   // pad it with a space so we can match things at the start of the 1st line.
   $ret = ' ' . $text;

   // matches an "xxxx://yyyy" URL at the start of a line, or after a space.
   // xxxx can only be alpha characters.
   // yyyy is anything up to the first space, newline, comma, double quote or <
   $ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<b>\\2</b>", $ret);

   // matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing
   // Must contain at least 2 dots. xxxx contains either alphanum, or "-"
   // zzzz is optional.. will contain everything up to the first space, newline,
   // comma, double quote or <.
   $ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<b>\\2</b>", $ret);

   // matches an email@domain type address at the start of a line, or after a space.
   // Note: Only the followed chars are valid; alphanums, "-", "_" and or ".".
   $ret = preg_replace("#(^|[\n ])([a-z0-9&\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "\\1<b>\\2-AT-\\3</b>", $ret);

   // Remove our padding..
   $ret = substr($ret, 1);

   return($ret);
}
// www.phpBB-SEO.com SEO TOOLKIT END


;)
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Postby AmirAbbas » Tue Dec 05, 2006 2:11 pm

oops :)

thanks a lot
this is very useful

cdz
another thanks for simple rewrite mod zero dupe you sent for me in PM
i forgot to reply to that PM :wink:
User avatar
AmirAbbas
phpBB SEO Team
phpBB SEO Team
 
Posts: 534
Joined: Thu May 11, 2006 3:30 pm
Location: IRAN

Postby dcz » Tue Dec 05, 2006 3:39 pm

You're welcome ;)
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Postby AmirAbbas » Sat Dec 09, 2006 2:28 pm

hi

another suggestion :wink:

how can we add rel"nofollow" to these sort of links ?
its very good because this trick is both user friendly and bot friendly


why you dont release it as a mod in phpbb.com
these mod are very useful :roll:
User avatar
AmirAbbas
phpBB SEO Team
phpBB SEO Team
 
Posts: 534
Joined: Thu May 11, 2006 3:30 pm
Location: IRAN

Postby dcz » Sat Dec 09, 2006 6:18 pm

I'll compile this into a mod when we'll have all the feature we want.


To add nofollow tag for the links posted without bbcode :

like this http://www.phpbb-seo.com/boards/

Open :

Code: Select all
includes/bbcode.php


Find :

Code: Select all
   $ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret);

Replace with :
Code: Select all
   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   $ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "\\1<a href=\"\\2\" rel=\"nofollow\" target=\"_blank\">\\2</a>", $ret);
   // www.phpBB-SEO.com SEO TOOLKIT END



To add them even in bbcode links open :

Code: Select all
template/subSilver/bbcode.tpl


Find :

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


Replace with :
Code: Select all
<!-- BEGIN url --><a href="{URL}" rel="nofollow" target="_blank" class="postlink">{DESCRIPTION}</a><!-- END url -->


But this would concern all links, I'll see how to only add the nofollow tag to external links only.

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Postby AmirAbbas » Sun Dec 10, 2006 5:52 pm

thank you a lot
:wink:

rel="nofollow" is supported with all bots. am i right ?
User avatar
AmirAbbas
phpBB SEO Team
phpBB SEO Team
 
Posts: 534
Joined: Thu May 11, 2006 3:30 pm
Location: IRAN

Postby dcz » Sun Dec 10, 2006 6:05 pm

You're welcome, and yes, at least the major ones do follow the nofollow directive.

It was them to want this new tag to fight against spam indexing in blogs, so they'd better do it ;)

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Postby AmirAbbas » Mon Dec 11, 2006 4:02 pm

a little problem

i have applied changes to bbcode.php but sometimes for some links it doesn't work. for example

http://forum.persia-cms.com/topic-vt150.html
the link in first post

or this one
http://forum.persia-cms.com/topic-vt140.html
the link in first post

:shock:
User avatar
AmirAbbas
phpBB SEO Team
phpBB SEO Team
 
Posts: 534
Joined: Thu May 11, 2006 3:30 pm
Location: IRAN

Postby dcz » Mon Dec 11, 2006 5:44 pm

Have you checked in the source if it was not a BBcode link ?

Because so far we only take car about the links posted without BBcodes for link deactivation.

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Postby AmirAbbas » Tue Dec 12, 2006 2:28 pm

dcz wrote:Have you checked in the source if it was not a BBcode link ?


yes. i have checked.

when the domain is in this form

http://www.phpbb-seo.com

it works perfectly but when you write URL without http:// it doesn't work

for example
www.phpbb-seo.com

the system won't add rel="nofollow" to above link
User avatar
AmirAbbas
phpBB SEO Team
phpBB SEO Team
 
Posts: 534
Joined: Thu May 11, 2006 3:30 pm
Location: IRAN

Next

Return to phpBB2 Forum

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 4 guests