vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How do I: Have Links From a Specific Domain Open in Same Window (https://vborg.vbsupport.ru/showthread.php?t=68654)

nogerorob 08-24-2004 06:13 AM

How do I: Have Links From a Specific Domain Open in Same Window
 
I asked this on vb.com and got no response.

As some of you know, my vB and php/html site are tightly integrated.

I want links I provide in my forums to content within the same domain to open in the same window. External links should still open a new window.

How do I do this?

Thanks,

r

Merjawy 08-24-2004 06:23 AM

since only your provided links should open in the same window, why not add the target tag to each link?

target=_self

nogerorob 08-26-2004 06:07 PM

Quote:

Originally Posted by Merjawy
since only your provided links should open in the same window, why not add the target tag to each link?

target=_self

Ah. I see. With Admin Privledges I should have no problem doing this by allowing myself to put html in my posts.

If a user wanted to post an in-domain link and I don't allow them to embed html in threads/replys are those stuck opening in a new window, or is there perhaps some automatic way have those parsed with a target=_self ?

Thanks,

rob

ethics 08-26-2004 07:18 PM

If I do believe there should be a way to do that :-/ not that expirenced with vB myself though ... I'll look into it and see if I can figure it out, although you would probably be better off just waiting for someone else to tell you cause they probably know off the top of their heads... I'll let you know if I find anything though.

Natch 08-30-2004 09:39 PM

This could be done with client-side javascript and the DOM...

I've seen this request over and over - I'll take a look at it once I have some time.

rake 08-30-2004 11:35 PM

Then again you could also hack the handle_bbcode_url function in functions_bbcodeparse.php
I'll do it tomorrow when i wake up. I'm going to bed now.

rake 08-31-2004 11:33 AM

in the functions_bbcodeparse.php file
replace

PHP Code:

        // standard URL hyperlink
        
return "<a href=\"$rightlink\" target=\"_blank\">$text</a>"


with

PHP Code:


        $domains 
= array(
            
'www.mysite.com',
            
'www.secondsite.com'
        
);

        foreach(
$domains as $domain)
        {
            if(
stristr($rightlink,$domain))
            {
                
// standard URL hyperlink
                
return "<a href=\"$rightlink\" target=\"_self\">$text</a>";
            }
            else
            {
                
// standard URL hyperlink
                
return "<a href=\"$rightlink\" target=\"_blank\">$text</a>";
            }
        } 



i haven't really tested it, but it should work. You can edit the domains array and make it, for example, open pages in the same window based on keywords...

Natch 09-01-2004 02:37 AM

I always prefer tempalte edits myself ... but you are right.


All times are GMT. The time now is 01:42 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00938 seconds
  • Memory Usage 1,731KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete