This topic is locked

Joomla/Facebook Redirect???

12/14/2010 10:48:03 PM
PHPRunner Tips and Tricks
C
cds92878 author

I Have My PHPR App In A Wrapper In My Joomla Site.

I Have Added A Java Redirect To My PHPR Site To Redirect To Joomla If Not In IFrame

<!-- Redirect If Not Show In Iframe -->

<!-- Begin Redirect -->

<script language="JavaScript">

<!--

function getgoing()

{

top.location="http://www.mysite.com/wrapper.html";;

}

if (top.frames.length < 1)

{

alert("You will be redirected to our main page in 1 seconds!");

setTimeout('getgoing()',1000);

}

//-->

</SCRIPT>

<!-- End Redirect -->


This Works Fine.
I Have Added Facebook "Like" Wrapper To My PHPR View Page

<iframe src="http://www.facebook.com/widgets/like.php?href=http://example.com";

scrolling="no" frameborder="0"

style="border:none; width:450px; height:80px"></iframe>


FYI

Replace http://www.mysite.com/myrecord_view.php?editid1=223

Note At The End Of The URL The "223" Is The Key Replace It With {$key_value} This Will Make Your "Like" Refer To The Exact And Correct Record.
If You "Like" Record 223 On Facebook It Will Say Chris Likes PHPR Record 223

(If You Put {$key_value} In The HTML Title

<title>PHPR Reccord {$key_value}</title>

)

Note: In The Title You Can Put Any Variable It Dose Not Have To Be The Key To Work

Such As {$name_value} Or {$description_value}
My Problem Is When You Click On The Like In Facebook It Takes You To Record 223 As It Should However Its Not In A Wrapper Which In Turn Redirects You To The Joomla Wrapper Witch Displays Login/Menu Not The Record.
I Have Done All This Work To End Up On The Menu Page.
I Am Looking For Javascript To Redirect Iframe To Referring URL If Not Refered By My Site.

Maby something like

function getgoing()

{

iframe.location=refering url;

}

if (top.frames.length > 1)


Pardon My Java I Do Not Know JavaScript Just Guessing

Is This Possible Can Anyone Help?

M
mmponline 1/10/2011

Please explain how and where you did this:

I Have Added A Java Redirect To My PHPR Site To Redirect To Joomla If Not In IFrame


Thanks

C
cds92878 author 1/10/2011
<!-- Redirect If Not Show In Iframe -->

<!-- Begin Redirect -->

<script language="Javascript">

<!--

function getgoing()

{

top.location="http://www.mysite.com/wrapper.html";;

}

if (top.frames.length < 1)

{

alert("You will be redirected to our main page in 1 seconds!");

setTimeout('getgoing()',1000);

}

//-->

</SCRIPT>

<!-- End Redirect -->


Basically This Will Perform A Java Redirect If Your Top Frame length Is Less Than 1 Deep (AKA Not In Frame)

Note Main Window Length Is 0

Iframe In Main Window Is 1

Iframe In Iframe In Main Window Is 2 Ect
You Can Add This Script To The Header To Work For The Entire PHPR Site.
My Site I Add This Script To Every Page (Header) Because I Want It To Redirect To Different Pages Depending On Which PHPR Page They Open.