javascript - if a web page is iframe on example.com site it shows some data not full page -
i want make website (example.com) open in iframe pages website (mydomain.com). in iframe should show different content original page linked in iframe.
<?php $url="http://example.com"; if (stripos($_server['request_uri'], '$url')) { echo 'this content gose on iframe page http://example.com '; else { echo "this content main web page (mydomain.com) , other websites webpage iframed "; } ?>
i have added sample code show want code?
there few things wrong here. (consult edit below).
firstly, variables not parsed in single quotes.
if (stripos($_server['request_uri'], "$url"))
or remove them
if (stripos($_server['request_uri'], $url))
you have missing closing brace }
conditional statement:
if (stripos($_server['request_uri'], '$url')) {
$url="http://example.com"; if (stripos($_server['request_uri'], $url)) { echo 'this content gose on iframe page http://example.com '; } // 1 missing else { echo "this content main web page (mydomain.com) , other websites webpage iframed "; }
and alone have thrown effect of:
parse error: syntax error, unexpected 'else' (t_else) in /path/to/file.php on line x
had error reporting been set.
edit:
however:
$_server['request_uri']
give you:
/some-dir/yourpage.php
which doubt want use here, or should use since fail.
you may have wanted use:
$url = strtolower($_server['server_name'] . $_server['request_uri']); if ( ($url=="www.example.com/file.xxx") || ($url=="example.com/file.xxx") ) { echo 'this content gose on iframe page http://example.com '; } else { echo "this content main web page (mydomain.com) , other websites webpage iframed "; }
n.b.: there no need add http://
in above edit, since populate automatically.
you can use:
(note: not add http://
or http://www.
or else, server's name).
if (strpos($_server['server_name'], "example.com") !== false)
another method can use if want check if it's coming specific folder/file:
$url = 'http://' . $_server['server_name'] . $_server['request_uri']; if(strrpos($url, "http://www.example.com/folder/file.php") !== false)
note use of !== false
important here , === true
fail if change that, in order try check truthness , give false positive, don't use === true
.
also note http://www.example.com
, http://example.com
not same. need use 1 fits criteria specifically.
Comments
Post a Comment