Integrating FBML and PHP in my facebook app?
|
02-19-2014, 12:41 PM
Post: #1
|
|||
|
|||
Integrating FBML and PHP in my facebook app?
I'm trying to use blocks of fbml and blocks of php in my facebook application. However, I am trying to use my php variables in the fbml and it's not working.
For example I want to use the fb:time and use a variable created in my php block above it called $start. But it won't let me because its not an "integer". for example I have something like <?php $start = 1235298413; //this number will change from queries to DB ?> <fb:time t=$start tz="America/New_York" /> Can someone help please? I want to display this time. Ads |
|||
02-19-2014, 12:42 PM
Post: #2
|
|||
|
|||
There are a few problems. First, you need quotes around your number. That's less important, because since $start is outside of PHP scope, it's being parsed just like regular HTML, which doesn't recognize $start, of course. There are a number of ways to do this.
1) Add PHP scope around your variable: <fb:time t="<?= $start ?>" tz="America/New_York" /> 2) Extend your overall scope to include the HTML code, but output it through PHP: <?php $start = 23434; echo "<fb:time t=\"$start\" tz=\"America/New_York\" />"; OR echo '<fb:time t="'.$start.'" tz="America/New_York" />'; ?> This is pretty simple PHP knowledge, so I'm under assumption you don't know PHP very well. I'd suggest that trying to make a Facebook app is not the best way to learn. Ads |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)