[RC1] Prime Links - Classify Locals & Target Externals

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!
Suggested Hosts
Locked
gajotnt
Registered User
Posts: 19
Joined: Sun Mar 02, 2008 5:12 pm

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by gajotnt » Tue Mar 18, 2008 7:54 pm

Dont know if this is what you want but these are de lines i had to add to the viewtopic.php file

Code: Select all

'GALLERY_IMG'		=> $user->img('icon_contact_gallery', 'PERSONAL_ALBUM'),

'personal_album'	=> '',

'personal_album'	=> ($row['album_id']) ? append_sid("{$phpbb_root_path}" . GALLERY_ROOT_PATH . "album.$phpEx", "album_id=" . $row['album_id']) : '',

'U_GALLERY'		=> $user_cache[$poster_id]['personal_album'],

User avatar
primehalo
Former Team Member
Posts: 2850
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by primehalo » Tue Mar 18, 2008 8:07 pm

gajotnt wrote:Dont know if this is what you want but these are de lines i had to add to the viewtopic.php file

Code: Select all

'GALLERY_IMG'		=> $user->img('icon_contact_gallery', 'PERSONAL_ALBUM'),

'personal_album'	=> '',

'personal_album'	=> ($row['album_id']) ? append_sid("{$phpbb_root_path}" . GALLERY_ROOT_PATH . "album.$phpEx", "album_id=" . $row['album_id']) : '',

'U_GALLERY'		=> $user_cache[$poster_id]['personal_album'],
Nope, that's not it either. I need a link to a post which contains a link to an album, but with my MOD disabled/removed. So I need to view this post, but with my MOD disabled/removed: http://www.pbterceira.com/viewtopic.php ... 117#p18771

The reason is because I need to see what the album link actually looks like in the source of the post when my MOD has not processed it.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

gajotnt
Registered User
Posts: 19
Joined: Sun Mar 02, 2008 5:12 pm

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by gajotnt » Tue Mar 18, 2008 8:13 pm

Ok removed your mod now no errors show on top of page but thumbnail does not show up, must be something wrong with the gallery mod

User avatar
primehalo
Former Team Member
Posts: 2850
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by primehalo » Tue Mar 18, 2008 8:27 pm

gajotnt wrote:Ok removed your mod now no errors show on top of page but thumbnail does not show up, must be something wrong with the gallery mod
With my MOD removed, this is what shows up for the link:

Code: Select all

<a href="http:////gallery/image_page.php?image_id=1"><img src="http:////gallery/thumbnail.php?image_id=1" alt="image_id: 1"></a>
Obviously, this is an incorrectly formatted URL, which is why my MOD was having trouble decoding it. So if you fix whatever is causing this problem then my MOD should work fine.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

gajotnt
Registered User
Posts: 19
Joined: Sun Mar 02, 2008 5:12 pm

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by gajotnt » Tue Mar 18, 2008 11:28 pm

Sorry for the trouble, will try to find out whats doing this

Sascha Mueller
Registered User
Posts: 95
Joined: Tue Mar 28, 2006 8:11 pm
Contact:

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by Sascha Mueller » Mon Apr 14, 2008 4:44 pm

Is this mod ready for phpBB 3.0.1 ?
Please excuse my bad English, I'm German!

User avatar
primehalo
Former Team Member
Posts: 2850
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by primehalo » Mon Apr 14, 2008 5:18 pm

Sascha Mueller wrote:Is this mod ready for phpBB 3.0.1 ?
Yes.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

Sascha Mueller
Registered User
Posts: 95
Joined: Tue Mar 28, 2006 8:11 pm
Contact:

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by Sascha Mueller » Mon Apr 14, 2008 5:57 pm

primehalo wrote:
Sascha Mueller wrote:Is this mod ready for phpBB 3.0.1 ?
Yes.
Thx for your reply. :)
Please excuse my bad English, I'm German!

Oggster
Registered User
Posts: 74
Joined: Mon Mar 17, 2008 12:31 am

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by Oggster » Tue Apr 15, 2008 4:06 am

Thanks you very much!

User avatar
DBM
Registered User
Posts: 159
Joined: Tue Oct 25, 2005 10:29 pm
Contact:

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by DBM » Wed May 07, 2008 2:09 am

Since I installed Prime Links, Google has stopped indexing links from my forum to other pages of my site (same domain).

But I'm sure I have set up my prime_links.php correctly:

Code: Select all

	// Options
	define('REMOVE_SUBDOMAINS', true);			// Remove these subdomains before checking the link (true will remove all subdomains)
	define('ANONYMIZE_EXTERNAL_LINKS', '');		// Example: 'http://anonym.to?'
	define('USE_TARGET_ATTRIBUTE', false);		// The attribute "target" is not valid for STRICT doctypes

	// Link relationships
	define('INTERNAL_LINK_REL', '');
	define('EXTERNAL_LINK_REL', 'nofollow');

	// Link targets
	define('INTERNAL_LINK_TARGET', '_blank');
	define('EXTERNAL_LINK_TARGET', '_blank');

	// Link classes
	define('INTERNAL_LINK_CLASS', 'postlink-local');
	define('EXTERNAL_LINK_CLASS', '');
It just seems like somehow the links to other pages of my site are being treated as external links and therefore passing on the 'nofollow' attribute to Googlebot.

But I can't see what I'm doing wrong if that's the case. Any ideas, anyone? :?

User avatar
primehalo
Former Team Member
Posts: 2850
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by primehalo » Wed May 07, 2008 3:04 am

DBM wrote:Since I installed Prime Links, Google has stopped indexing links from my forum to other pages of my site (same domain).

But I'm sure I have set up my prime_links.php correctly:

Code: Select all

	// Options
	define('REMOVE_SUBDOMAINS', true);			// Remove these subdomains before checking the link (true will remove all subdomains)
	define('ANONYMIZE_EXTERNAL_LINKS', '');		// Example: 'http://anonym.to?'
	define('USE_TARGET_ATTRIBUTE', false);		// The attribute "target" is not valid for STRICT doctypes

	// Link relationships
	define('INTERNAL_LINK_REL', '');
	define('EXTERNAL_LINK_REL', 'nofollow');

	// Link targets
	define('INTERNAL_LINK_TARGET', '_blank');
	define('EXTERNAL_LINK_TARGET', '_blank');

	// Link classes
	define('INTERNAL_LINK_CLASS', 'postlink-local');
	define('EXTERNAL_LINK_CLASS', '');
It just seems like somehow the links to other pages of my site are being treated as external links and therefore passing on the 'nofollow' attribute to Googlebot.

But I can't see what I'm doing wrong if that's the case. Any ideas, anyone? :?
Usually not a good idea to have REMOVE_SUBDOMAINS set to true when there is more than one dot after the domain (such as .co.uk).
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

User avatar
Funk Theory
Registered User
Posts: 731
Joined: Mon Sep 25, 2006 3:33 pm
Location: UK
Contact:

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by Funk Theory » Sun Jun 01, 2008 10:53 pm

excellent, followed the phpbb kb article got no errors, cleared my cache but still wouldnt open in new window, installed this mod, works straight away, top job! :D

User avatar
Funk Theory
Registered User
Posts: 731
Joined: Mon Sep 25, 2006 3:33 pm
Location: UK
Contact:

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by Funk Theory » Mon Jun 02, 2008 8:38 pm

Actually, one 'problem' If i click a link on a users profile it still opens in the same window however if i click the banner sig on their profile it doesnt :?

User avatar
primehalo
Former Team Member
Posts: 2850
Joined: Fri May 06, 2005 5:58 pm
Location: Redding, CA
Contact:

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by primehalo » Mon Jun 02, 2008 11:40 pm

Funk Theory wrote:Actually, one 'problem' If i click a link on a users profile it still opens in the same window however if i click the banner sig on their profile it doesnt :?
The MOD only affects links within posts (or more technically, links that are within text that is written by PHP). Links on a user's profile (except those in signatures) cannot be parsed, because the HTML for those links are hard-coded into the template. If you want those to open in a new window, you'll have to open the template file and add the following to the link HTML:

Code: Select all

onclick="this.target='$new_target';"
In the future, I may add some code and template variables to the MOD in order to accomplish this.
Ken F. Innes IV
My Extensions | My MODs | My Topics | My Site: Absolute Anime
Experience the wonder of Japanese Animation!

buchoman
Registered User
Posts: 2
Joined: Thu May 22, 2008 6:51 pm

Re: [RC1] Prime Links - Classify Locals & Target Externals

Post by buchoman » Wed Jun 04, 2008 3:17 pm

Fantastic mod! I wanted to tweak this a little bit in order to treat certain select domains as internal links. The fix was discussed much earlier in this thread at: http://www.phpbb.com/community/viewtopi ... a&start=36

The example given shows how to treat one external domains ("example.com") in the same manner as an internal link. However, I would like to treat about 30 external domains ("example1.com", "example2.com", etc) as internal.

Based on the example provided in IPB_Refugee's earlier post, I have opened prime_links.php, and searched for the following code:

Code: Select all

	$is_local = !$scheme || ($scheme && !preg_match('/^[a-z0-9.]{2,16}$/i', $scheme));
			}

AFTER, I added:

Code: Select all

           
//EXCEPTIONS (TREAT THE FOLLOWING AS INTERNAL LINKS)

	if (strpos($url, "example1.com") > 0)
     {
        $is_local = TRUE;
     }

	if (strpos($url, "example2.com") > 0)
     {
        $is_local = TRUE;
     }

	if (strpos($url, "example3.com") > 0)
     {
        $is_local = TRUE;
     }

... and so on.

The above works, but my illustration reflects only three domains. Is there a more elegant solution to accomplish the same result for a larger number of domains? (I suspect there is, but my PHP skills are sadly deficient!)

Locked

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