pHP q? programmers
- Started
- Last post
- 15 Responses
- kodap
here's the thing:
I want to have a php file loaded where other is included , just like targeting to an iframe, how can I do that. I tried searching at http://php.net &static =true but too much to look for.
is is so complicated?
I know how to include and some php basics.. (noob) because I wanted to have a more simple solution for search engines and avoiding this way iframes .
on a last resort if I have to use iframes, how can I redirect the user to view the whole homepage when he reaches the iframe document coming from a search portal??
Thanks in advance for any programmers still awake.
- cosmo0
ummm...can explain the problem a little better, couldn't understand it very well.
- MrDinky0
cosmo would like you to rephrase this question please
- kodap0
I meant the variable $static=true
I'm almost positive that it will work around this variable that is supposed to be on the included php to switch for the one I click, but I don't have a clue on how to give instructions into it
- nospacebar0
Why not use a conditional to specify the include?
if ($_REQUEST['section'] == 'home') {
include('./home.php');
}
- kodap0
here's again:
I have (for instance) a big div and inside is
[ ?PHP
$static = TRUE; or FALSE
include("folder/somecontent.php...
?]Then I have another php mayby the navigation that will link a new php to that same dive where is content
now I'm confused if its meant to be TRUE or FALSE
- kodap0
that's a good tip, nospace ..
I thought it was very easy the way I had in mind.
i'm a true noob.. so I'll have to find out how to implement that..
- cosmo0
ok, wat is the $static variable used for and wat is the default value set on page load?
- lifeinbinary0
on a last resort if I have to use iframes, how can I redirect the user to view the whole homepage when he reaches the iframe document coming from a search portal??
(Jul 10 05, 18:41)
-------
i am not sure what you asked about the php, didn't quite understand. but the iframe thing can be done with using javascript. here's the code:
if (parent.location.href == self.location.href)
window.location.href = 'index.htm';index.htm can be any page you want the iframe to go to. put this code in an external .js file or even put it directly in the head section of the html.
so basically if someone tries to access the iframe without going to the parent frame first, they will be redirected to go the parent frame.
as a result, the user will not be able to access just the iframe. they always will have to go visit it through the parent frame. i hope that made sense.
- cosmo0
you could check the server Referer $_SERVER["HTTP_REFERER"]
to check if user entered your site from an outside link, if they did just redirect them to your homepageif ("www.yoursite.com" != $_SERVER['REQUEST_URI'])
{
header ("location: www.yoursite.com");
}
- kodap0
well maybie the static thing is messing with me because I was trying to split up a pre-made php script.. and I made a confusion because that's not a function but a variable..
let me search for that exactly and try by myself... I'd have to look for someone to dig into the code here with me and now its impossible...
but now forgeting the static thing my question is still valid..
I'm feeling like a dumb who doesn't know how to ride a bike in a bike convention..
Thanks
- kodap0
yeah maybie that's a better solution for me now
hehe
- cosmo0
send me an email if u got questions.
- foreign0
hey kodap, check this article. i learned php includes and "conditional switching" here, which is what i think you're looking for:
http://www.digital-web.com/artic…
includes, switching and an example of a menu.
- kodap0
That is really nice and will help me! thanks foreign
- foreign0
no problem kodap.