|
-
May 16th, 2012, 09:21 AM
#16
Re: Total number of Facebook group members
No...the override all depends on the actual web server. Your host probably has it configured to not be user changeable.
However, the problem isn't the include directly. It's how you're including the file. You need to use relative path...not the full directory. The ability to include cross-domain files creates huge security holes in any online development.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
May 17th, 2012, 05:46 PM
#17
Re: Total number of Facebook group members
Changed the path to this:
Code:
<div>
<?php
require_once('/home/zardmediagroup/wp-content/themes/romeo_e_giulietta/fb_api/facebook.php');
$config = array(
'appId' => 'MYAPPID',
'secret' => 'MYSECRETID',
'cookie' => true
);
$facebook = new Facebook($config);
$query = urlencode("SELECT uid FROM group_member WHERE gid = MYGROUPID");
try {
$fbData = $facebook->api("/fql?q={$query}");
echo count($fbData['data']);
} catch (FacebookApiException $e) {
echo 'Errore:<br />';
var_dump($e->getResult());
};
?>
</div>
But this time I'm having a "Headers already sent" errors:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/zardmediagroup/wp-includes/class.wp-scripts.php:65) in /home/zardmediagroup/wp-content/themes/romeo_e_giulietta/fb_api/facebook.php on line 37
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/zardmediagroup/wp-includes/class.wp-scripts.php:65) in /home/zardmediagroup/wp-content/themes/romeo_e_giulietta/fb_api/facebook.php on line 37
Last edited by Mad_Griffith; May 18th, 2012 at 05:58 AM.
-
May 17th, 2012, 08:47 PM
#18
Re: Total number of Facebook group members
All header data must be setup before any output. In this case, you have a <div> starting out. I'm guessing that when creating a new instance of Facebook() that it includes header information. So put that PHP code at the top of your page.
PHP Code:
<?php require_once('/home/zardmediagroup/wp-content/themes/romeo_e_giulietta/fb_api/facebook.php'); $config = array( 'appId' => '350224611710644', 'secret' => 'a604150d3b8184002d1f04448724d17c', 'cookie' => true ); $facebook = new Facebook($config); $query = urlencode("SELECT uid FROM group_member WHERE gid = 457030854323270"); try { $fbData = $facebook->api("/fql?q={$query}"); $member_count = count($fbData['data']); } catch (FacebookApiException $e) {}; ?> <div><?php echo $member_count; ?></div>
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
May 18th, 2012, 01:43 AM
#19
Re: Total number of Facebook group members
 Originally Posted by PeejAvery
All header data must be setup before any output. In this case, you have a <div> starting out. I'm guessing that when creating a new instance of Facebook() that it includes header information. So put that PHP code at the top of your page.
PHP Code:
<?php require_once('/home/zardmediagroup/wp-content/themes/romeo_e_giulietta/fb_api/facebook.php'); $config = array( 'appId' => '350224611710644', 'secret' => 'a604150d3b8184002d1f04448724d17c', 'cookie' => true ); $facebook = new Facebook($config); $query = urlencode("SELECT uid FROM group_member WHERE gid = 457030854323270"); try { $fbData = $facebook->api("/fql?q={$query}"); $member_count = count($fbData['data']); } catch (FacebookApiException $e) {}; ?> <div><?php echo $member_count; ?></div>
Ok I see, thx
Last edited by Mad_Griffith; May 18th, 2012 at 05:59 AM.
-
May 22nd, 2012, 05:41 AM
#20
Re: Total number of Facebook group members
 Originally Posted by PeejAvery
All header data must be setup before any output. In this case, you have a <div> starting out. I'm guessing that when creating a new instance of Facebook() that it includes header information. So put that PHP code at the top of your page.
PHP Code:
<?php require_once('/home/zardmediagroup/wp-content/themes/romeo_e_giulietta/fb_api/facebook.php'); $config = array( 'appId' => '350224611710644', 'secret' => 'a604150d3b8184002d1f04448724d17c', 'cookie' => true ); $facebook = new Facebook($config); $query = urlencode("SELECT uid FROM group_member WHERE gid = 457030854323270"); try { $fbData = $facebook->api("/fql?q={$query}"); $member_count = count($fbData['data']); } catch (FacebookApiException $e) {}; ?> <div><?php echo $member_count; ?></div>
For some reason this script doesn't return anything (error nor the desired result).... why? I placed the first bit right after the doctype is opened.
Last edited by Mad_Griffith; May 22nd, 2012 at 05:43 AM.
-
May 22nd, 2012, 10:28 AM
#21
Re: Total number of Facebook group members
Place the PHP code above EVERYTHING else. Then insert the echoing of the $member_count wherever you want it in the page.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
May 22nd, 2012, 02:38 PM
#22
Re: Total number of Facebook group members
Still not showing anything...
-
May 22nd, 2012, 02:50 PM
#23
Re: Total number of Facebook group members
Are there any PHP errors being outputted? If not, are you using some sort of CSS reset? In that case, you're going to have to style the <div>. Right now, it may just have the text being a size 0 or the same color as the background.
Edit: View the source. I'm sure you'll see that it is there...just stylized to not be visible in HTML/CSS output.
If the post was helpful...Rate it! Remember to use [code] or [php] tags.
-
May 22nd, 2012, 03:00 PM
#24
Re: Total number of Facebook group members
mmmh yeah I made a reset stylesheet but DIV are set as display block (the "member count" div as well)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|