Norman Posted June 18, 2008 Share Posted June 18, 2008 You know, when somebody post a new link on my forum (for example), or when I post an external link into one oh my .php page, I would like to open a new window using a link like this:(in my site's pages) http://www.example.com/external-link.php?=...condexample.com(in that site) http://www.secondexample.com/ -> using a tab wich say [this site is not a part of *my site name*]Can you help me? Link to comment Share on other sites More sharing options...
Norman Posted June 25, 2008 Author Share Posted June 25, 2008 Nobody here? Link to comment Share on other sites More sharing options...
justsomeguy Posted June 25, 2008 Share Posted June 25, 2008 You just need to set up either a frameset or an iframe and pass the URL to it as the src attribute. Link to comment Share on other sites More sharing options...
Norman Posted June 25, 2008 Author Share Posted June 25, 2008 Thanks for your reply. And how do I do that? Can you please post a code example? Link to comment Share on other sites More sharing options...
justsomeguy Posted June 25, 2008 Share Posted June 25, 2008 <iframe src="<?php echo $_GET['url']; ?>"></iframe>You can put whatever you want around it. Link to comment Share on other sites More sharing options...
Norman Posted July 8, 2008 Author Share Posted July 8, 2008 Thanks. But how do I do a script that convert all my existent and all my future external urls with that iframe? Link to comment Share on other sites More sharing options...
justsomeguy Posted July 8, 2008 Share Posted July 8, 2008 Convert all your future URLs? I suppose you need a DeLorean and a flux capacitor, with 1.21GW of power and then you can go into the future and run the script on whatever URLs you want.If you want to search for link tags in a string of text then you need to use a regular expression to find them all and get the URL from each tag. PHP has a function called parse_url that you can use to break up the URL into its parts, and you can add your extra stuff to the querystring, put the URL back together, and replace the link tag already on the page with str_replace. That's if you do it in PHP, with Javascript you would have to break up the URL yourself. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.