Need extra help with your Joomla site? Consider paid Joomla support by the developer of Chameleon and MetaMod.
- Index
- » Chameleon / ChameleonLite
- » Chameleon
- » Facebook detection
Facebook detection
Facebook detection
I have found a way to detect accurately when we are within facebook :-)
Just a rule with
Code:
if ($_GET['fb_sig_api_key'] == 'your api key here') return true; else return false;
and it's all done !
However I get an error from metatemplatepro helper saying that fb_sig_api_key is undefined index.
Can you help me how to solve this ?
Re: Facebook detection
Hi alterna,
Are you saying that this works when you are using your Joomla app as an iframe within Facebook, but that it comes up with an error when it's NOT within Facebook?
Actually that makes sense... just change $_GET to @$_GET to suppress the warning that occurs when the URL parameter "fb_sig_api_key" is not present.
This is a really good way of detecting that you're inside Facebook - excellent! I take it that this only occurs on the first page of your site though, and that you have to use a session variable to store that info for the rest of the session?
Cheers,
Stephen
14-Feb-10 19:54:40
Re: Facebook detection
metamodguy wrote:
Hi alterna,
Actually that makes sense... just change $_GET to @$_GET to suppress the warning that occurs when the URL parameter "fb_sig_api_key" is not present.
Just perfect ! exactly what I needed. I don't know about programming but I am just thinking about the best way to get things what I want them to be
Yes I still need a session variable to detect when I go out of facebook and when I come back again, using links at the end of the templates.
Every thing is working very well except for a small thing with the mobile template. I cannot find a way to keep a session variable active from mobile to desktop, guess I mixed my rules but do not see where
Anyway you can make a recipe about facebook that way, this is just good !
And by the way, iframe is really the way to go for a facebook app, you can still make fbml pages with jumi for invites and profiles, take a look at http://apps.facebook.com/icontes (Sorry it's still not translated yet )
Re: Facebook detection
Hi alterna,
Thanks for the info about Facebook issues.
I've just released MetaTemplate 1.4. This has a few things you'll be interested in:
1 - you can now set up to 2 cookies or session variables per SUCCEED or FAIL action
2 - there's now a text box for entering the Referrer URL (just to save you using the PHP box for it)
3 - if you *do* use the PHP box, and return a template name, then the cookies and/or session variables will now get set (they didn't before)
Session variables are not going to work between different subdomains, sorry. This is an issue of cross-domain cookies. The session mechanism in Joomla is probably hard coded to not allow sharing of sessions between subdomains. It *may* be possible to set some sort of cross-domain temporary cookie using PHP code, in the SUCCEED action PHP box, but this depends on whether browsers allow it, and I haven't looked into this.
Best regards,
Stephen
Re: Facebook detection
Well this just PERFECT like it is now !
I don't need subdomains any longer as I can switch templates depending on so much variables. I just use subdomains to tweak the css of the templates and switch them off once finished.
There is just two things that I need to test a little more:
- first one is the switch between languages, I have noticed inconsistencies with some translation but have to check whether it's my system of not
- second one which is the more important is that metatemplate does not seem to work well with the cache plugin activated. It's a real mess with the css in this case (guess it has to do with some templates having the same css name or something like this) and even with some pages not showing the right template. I had to deactivate it and only leave the cache in global config.
Once deactivated all is ok, the website is just a little slower but not that much.
Any thoughts on this ?
Re: Facebook detection
Regarding the cache problem - yes, this is to be expected. The system cache plugin I think caches the output of pages according to URL, unless you are logged in. So if you do anything with the templates that does not vary according to URL (e.g. time of day, GeoIP, etc), then it's going to cache the page then serve out that same cached version to everyone even when the time or GeoIP location of the visitor changes. I'd like to investigate making a modified version of the cache that might allow you to make the cache take account of the variables that you use in your rule, where possible.
e.g. if you are using MetaTemplate (or MetaMod) rules that make a different version for people from FR and DE, and everyone else, then the cache should do a GeoIP lookup then do one cache for FR, one for DE, and one for everyone else. Of course, the more variables you use to control the template/content, the more complex this matrix becomes :-( I am not sure how possible this is going to be.
- Index
- » Chameleon / ChameleonLite
- » Chameleon
- » Facebook detection
Board Info
- Board Stats:
- Total Topics:
- 1699
- Total Polls:
- 6
- Total Posts:
- 5967
- Total Posts Today:
- 2
- User Info:
- Total Users:
- 8027
- Newest User:
- henley7346
- Members Online:
- 1
- Guests Online:
- 182
- Online:
- henley7346
Forum Legend:
Topic
New
Locked
Sticky
Active
New/Active
New/Locked
New Sticky
Locked/Active
Active/Sticky
Sticky/Locked
Sticky/Active/Locked