Page 1 of 2
A php frames solution?
Posted: Wed Apr 24, 2002 7:45 pm
by lc
This is another thing I've been wondering about.
I think we're all familliar with the problems we all get with frames... especially with people linking directly into a content page.. which could mean that they do get the content they want but not the menu of your site which would usually be in another frame.
Is there a good way to perhaps solve that in php? I know of a dodgy java script that could do it... but php? Can php check the browser name? Or I think that is what the javascript does.
Posted: Wed Apr 24, 2002 10:55 pm
by BigE
PHP can infact detect the browser that the user is using. Check this page out, it kinda gives a good description on how it works.
http://www.php.net/manual/en/function.get-browser.php From there you can use include() to get the page you want. Hope that helps.
Posted: Thu Apr 25, 2002 8:43 am
by lc
yeah that far I got too... but well I think I'll have to try it out to see if it happens to output the name of the frame as well, cause that's the crucial thing here.
I'll try it tomorrow.
Posted: Sun May 19, 2002 11:17 am
by lc
Okiedokie that doesn't work.
Which brings me to another thought.
In frames a source is usually set at
Now that's all nice but apparently variables aren't carried in a frameset. Meaning say my index.php holds a frameset and I set a variable in index.php that variable is lost for the content of it's frames.
And I don't want to create links and src with ?data=blabla
Anyone have an idea of how to solve this? Am I rambling?
Basicly I want to post data to a page without a form or ?data=blabla links.
And I want the post not to be seen by search engines and such.. possible?
Posted: Sun May 19, 2002 12:56 pm
by volka
cookies and sessions
Posted: Sun May 19, 2002 9:06 pm
by lc
Well perhaps.. but I don't like cookies. And what is a session and how does it work?
Posted: Sun May 19, 2002 9:13 pm
by hob_goblin
what i do is have my little layout template, which has the menu and all that, and in it has like
echo "$content";
where i want all the content,
and in my pages i have:
$content = <<<HTML
-STUFF-GOES-HERE-
HTML;
include('layout.php');
so the layout and menu and everything always pops up with the content,
also on dynamicdrive.com they have a javascript that checks if the file is in frames, or not in frames, or something...that was probably what you were talking about though
Posted: Sun May 19, 2002 9:56 pm
by volka
Posted: Sun May 19, 2002 10:10 pm
by lc
Goblin yes that was what I was talking about and the way you do your sites is in a way like mine as well, but that's not how to circumvent the frames issues.
I think you either do need to use that sort of javascript or sessions. neither one really suits my needs very well. And thx Volka.. I read it.
I still feel as if there must be a better way.
Posted: Sun May 19, 2002 11:01 pm
by lc
actually know what... I think I give up and will just create sites with iframes for frames from now on and I'll stick on a tiny little text menu that'll be invisible inside the iframe cause of the width and no scrolling.
Still think it's silly no one ever came up with a simple standard solution for this. cause all you really need is the ability for a page to check what the name of the frame it's loaded in is.
Posted: Mon May 20, 2002 5:33 am
by ShrineMaster
A few ways to prevent people from linking to a page in frames is to either check the referer and bounce them to the framed index page if the referer isn't your site or use javascript to check if the page is in Javascript (Annoying, check out
this page on Microsoft's documentation site to see just how annoying it is. Open other pages in new windows).
Posted: Mon May 20, 2002 6:04 pm
by hob_goblin
it has to be stored somewhere, i just dont know where, and how to extract it....
it's going to be one of those things that you will see in the future and you'll say "back in my day we couldn't see what the browsers name is" heh..
oh well..
Posted: Mon May 20, 2002 7:49 pm
by volka
here is a tutorial how to prevent hot linking with .htaccess
Posted: Mon May 20, 2002 8:56 pm
by hob_goblin
which had nothing to do with what he asked :-/
Posted: Mon May 20, 2002 9:17 pm
by volka
which has to do with it as the functionality is not limited to pictures. You may use this to redirect to another page (the index page) if your content page hasn't been queried with the proper referer