Identifying the current page (profile/canvas)

Jul 6, 2007 at 4:48 AM
One thing i don't get...
I'd like to do is run one function in profile and other in canvas, how do I test for the current page?
I am using ver 1.2 works great in both profile and canvas thanks!
Coordinator
Jul 6, 2007 at 2:53 PM
I don't think I understand your question. Can you explain a bit more?

I think you might want to look at the fbsigin_canvas request parameter similar to what I do in the canvas base page. (we could probably make that available as a property from the canvas base page).

But, like I said, not sure I am understanding your question.
Jul 6, 2007 at 3:20 PM
Sure, I render both profile and canves pages in FBML using the v1.2 release.
Some part of my FBML are in <fb:narrow> and another is in <fb:wide> but the FBML in these tags doesn't render in the canvas page, I would like to have some logic that goes somthing like (page = profile are just placeholders):
Dim text As String
if(page = profile)then
text ="<fb:wide> FBML for the right profile column </fb:wide>"
text = text & "<fb:wide> FBML for the right profile column </fb:wide>"
else
text = "default FBML that will show on non-profile pages"
end if
Label.Text = text
Me.FBService.SetFBML(text)
Coordinator
Jul 6, 2007 at 7:35 PM
Hmm.

I am not positive but, I think you are confused on what SetFBML is used for.

SetFBML always writes to your apps section of a users profile. That is the only way to write a profile. It is static when you write it.

Your canvas page is rendered using the result of them posting to your url. In this case, you are writing your FBML out to a label that is rendered to their server when someone requests your canvas page. You don't need to do both at all times.

Basically, you should just be saying, whenever I need to update how my app looks on the profile page, I call SetFBML with the updated FBML. And whenever someone accesses my canvas page, I output fbml directly to the response of my page. Using Response.Write or setting text on a label or something like that.

Another way to think about. The profile FBML will always be whatever it was the last time SetFBML was called for that user. On the other hand, every request for you canvas page will make a post to your server (your callback url) and you get to build/format whatever FBML you want. The facebook server takes that response, translates it to html on the fly and renders your canvas page on your behalf.

Does this make sense?
Jul 6, 2007 at 11:50 PM
Edited Jul 7, 2007 at 1:10 AM
Thanks, I think I got what you are saying (see below)

Dim text1, text2 As String
text1 ="<fb:wide> FBML for the right profile column </fb:wide>"
text1 = text1 & "<fb:wide> FBML for the right profile column </fb:wide>"
text2 = "default FBML that will show on non-profile pages"
Label.Text = text2
Me.FBService.SetFBML(text1)