check baseurl / foward to another - help please

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bliixx
Forum Newbie
Posts: 1
Joined: Sun Nov 16, 2003 1:01 pm
Location: hell, usa

check baseurl / foward to another - help please

Post by bliixx »

ive been searching these forums for ahwile, and searching other places, and cant seem to find what im looking for.

i have a website, which uses an iframe to display the site content, but with a navigation system always showing at the right.
when people search google or somethin and my site comes up, it often comes up as the page that is to be shown in the iframe, and theres no navigation on the left because of this. they have no way of browsing my site because of this also.
ive been searching for ahwile for a script that will check to see if the page is the (top) link (?) like in the nav bar, and if it is not, to reload to the one i want.

ie. many people are refered to my site at news.php but this shows just the news and not the nav.
but if you goto the main site it shows the news.php in an iframe.

if anyone knows how to make it check to see if a page is the baseurl and refresh to another one if it is, i would be greatly appreciative.

thanks
User avatar
scorphus
Forum Regular
Posts: 589
Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:

Post by scorphus »

Moderators and admins: what are the policies regarding signatures and avatars here? I'm full of these porn things all around the web, and I think here is not the place for such things... and this is not the first sig of this kind...

Regards,
Scorphus.
User avatar
scorphus
Forum Regular
Posts: 589
Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:

Post by scorphus »

You could play with showiframe.php:

Code: Select all

<html>
<head>
	<title>.o0 PHPDN :: Iframe example - showiframe.php 0o.</title>
</head>

<body>

<iframe src="iframe.php"></iframe>

</body>
</html>
and iframe.php:

Code: Select all

<html>
<head>
	<title>.o0 PHPDN :: Iframe example - iframe.php 0o.</title>
	<script language="JavaScript1.2" type="text/javascript">
	<!--
	function checkForIframe () &#123;
		document.writeln(window.parent.location);
		document.writeln(top.frames.length);
		document.writeln(top.location.href);
	&#125;
	//-->
	</script>
</head>

<body>

<script language="JavaScript1.2" type="text/javascript">
<!--
checkForIframe();
//-->
</script>

</body>
</html>
Open showiframe.php in one window and iframe.php in another and see what you have to/can do with window.parent.location, top.frames.length and top.location.href.

Regards,
Scorphus.
Post Reply