iFrame - My Problem

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
metalice
Forum Newbie
Posts: 5
Joined: Thu Aug 25, 2011 12:15 pm

iFrame - My Problem

Post by metalice »

hi all,

im very new to all this facebook apps platform.

i have a facebook iframe tab when someone press like its opens him a box with a button named "view" ,

when the person clicks on the button he is redirecting to the photos page in the facebook fan page to see the the photos.

i want instead of the box the opens to redirect the person directly after he pressed liked to the photos page without any box or any button , is it possiable?

and another thing i noticed that when right now when you press the view button, the photos page is opening in the same iframe and its look funny like faceook inside facebook.

so i need like a redirect command , instead of opeing a box with button view , i want the browser to reload a diffrent page (the photo page) and go out from the iframe , like refresh the browser to a dofrrent page so it will go out form the iframe.

i attached here the code of my page:

Code: Select all

<?php
    header('Content-type: text/html; charset=utf-8');
     // prevent from caching
    header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
    header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
    header('Cache-Control: no-store, no-cache, must-revalidate');
    header('Cache-Control: post-check=0, pre-check=0', false);
    header('Pragma: no-cache');
    define('BASE_DIR', './');

    /**
     * Check liked
     * @return bool
     */
    function isLiked() {
        $data = getData();
        return $data[page][liked];
    }
    /**
     * Get signed request data
     * @return array
     */
    function getData () {
        $signed_request = $_REQUEST[signed_request];
        list($encoded_sig, $payload) = explode('.', $signed_request, 2);
        return json_decode(base64_decode(strtr($payload, '-_', '+/')), true);
    }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style/style.css" />
<title>Lorem Ipsum</title>

<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>

  FB.Canvas.setAutoResize();

</script> 

<script language="javascript" type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("#btn").click(function(){
 	 $(".downloadBox").hide();
  });
  $("#videoImg").click(function(){
 	 $(this).hide();
  });
});
</script>

</head>


<body>
    <!--start wraper-->
    <div class="wraper">
    	<!--======start Main area-->
    	<div class="main">
        	<!--======start Header-->
        	<div class="header">
            	<img src="images/arrow_header.jpg" alt="arrow" />
                <span>Click <b>"Like"</b>Above</span>
                <p>xxx xxxx</p>
                <i>Jxxxxxxxxxxxxxxxxxxxxxxxxxxx</i>
            </div>
            <!--===========start box-->
            <div class="box">
            	<div class="video">
            		<object width="480" height="300"><param name="movie" value="http://www.youtube.com/v/xxxxxx?fs=1&hl=en_US&rel=0&autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Sftgm5ZGyxk?fs=1&hl=en_US&rel=0&autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="300"></embed></object>
                </div>
            <?php
            if ( isLiked() ) {
    ?>
                <div class="downloadBox" id="shBtn">
                    <b>Thanks for liking this page</b>
                    <a class="btnDownload" href="xxxxxx"><img src="images/download_now_1.png" alt="download btn"></a>
                    <a href="#" id="btn">Show&nbsp;/&nbsp;Hide</a>
                </div>
                
             <?php
			}
			 ?>
            </div>
            
            <!--===============start content Text-->
            <div class="conText">
            	<b><u>x x x x </u></b>
                <p>xxxxxxxxxx xxxxxxxxxx xxxxxxxxxxx</p>
            </div>
            <!--===============end content Text-->
       </div>
       <!--======end main area-->
            <!--========start footer==============-->
            <div class="footer">
            	<b>Join Us</b>
                <ul class="footerNav">
                	<li><a href="http://www.facebook.com/sharer.php?u=http://www.facebook.com/" title="Share with us on facebook" target="_blank"><img src="images/btn_facebook.png"/></a></li>
                    <li><a href="mailto:xxxxx"><img src="images/btn_mail.png" alt="mail btn" /></a></li>
                    <li><a href="http://twitter.com/" target="_blank"><img src="images/btn_twitter.png" alt="twitter btn" /></a></li>
                </ul>
            </div>
            <!--========end footer==============-->
    </div>
    <!--end wraper-->
    
   <div id="fb-root"></div>
    
</body>
</html>
now, in the 71 line it start the commands of what to do after its liked:

Code: Select all

            <?php
            if ( isLiked() ) {
    ?>
                <div class="downloadBox" id="shBtn">
                    <b>Thanks for liking this page</b>
                    <a class="btnDownload" href="http://gator1550.hostgator.com/~metalice/facebook/redirect.php"><img src="images/download_now_1.png" alt="download btn"></a>
                    <a href="#" id="btn">Show&nbsp;/&nbsp;Hide</a>
                </div>
                
             <?php
			}
			 ?>
            </div>
how can i change it to redirect , lets say to http://xxx.xxx.xx.com and not open in the iframe tab of facebook?

TNX!!!!

Matan
Post Reply