Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-08-2013, 12:28 PM   PM User | #1
tonyjms2005
New Coder

 
Join Date: Oct 2008
Posts: 40
Thanks: 1
Thanked 0 Times in 0 Posts
tonyjms2005 is an unknown quantity at this point
facebook postToFeed() on phpbb3 post, slight issue, help required

I have a phpbb3 forum that I have modified for my requirements. I have used the Facebook post to feed dialog to allow users to send the text from their forum post to their facebook wall.

I have added the code between the <!-- BEGIN postrow --> <!-- END postrow --> tags.

The postToFeed() function works well, all except when I there are more then one post to a topic/thread. The PostToFeed() button/link appears on each post of the topic, but when using the function, it will only post the most recent post in the topic rather than the post that the button/link appears on.

Has anyone please got any suggestions? Here is my code from the viewtopic_body.html or which I have removed some of the styling to make the code easier to read:




Code:
    <!-- BEGIN postrow -->
        		<div class="postbody">
        
        
        			<a href="#p{postrow.POST_ID}">{postrow.POST_SUBJECT}</a>
        			
        			<div class="content">{postrow.MESSAGE}</div> ************************this is the topic text content here		
        		</div>
        
        		
        	<div id='fb-root'></div>
        
            <script src='http://connect.facebook.net/en_US/all.js'></script>
            <p><img src="http://static.ak.facebook.com/images/share/facebook_share_icon.gif?6:26981"/><a onclick='postToFeed(); return false; '>Post to Facebook profile</a></p>
            <p id='msg'></p>
            <script> 
              FB.init({appId: "83103676329", status: true, cookie: true});
        
              function postToFeed() {
        
                // calling the API ...
                var obj = {
                  method: 'feed',
                  redirect_uri: 'http://tributetothem.com',
                  link: 'http://www.tributetothem.com/phpBB3/viewtopic.php?p={postrow.POST_ID}',
                  picture: 'http://tributetothem.com/images/logo.gif',
                  name: '{TOPIC_TITLE}',
                  caption: 'http://tributetothem.com',
                  description: '{postrow.MESSAGE}'  ************************this is the topic text content here
                };
        
                function callback(response) {
                  document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
                }
        
                FB.ui(obj, callback);
              }
            
            </script>
        
        	</div>
        <!-- END postrow -->

Thanks in advance

Antony
tonyjms2005 is offline   Reply With Quote
Old 01-08-2013, 02:13 PM   PM User | #2
tonyjms2005
New Coder

 
Join Date: Oct 2008
Posts: 40
Thanks: 1
Thanked 0 Times in 0 Posts
tonyjms2005 is an unknown quantity at this point
Hi

I just solved it using the post_id as a variable for the function name.

Thanks

Antony
tonyjms2005 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:51 PM.


Advertisement
Log in to turn off these ads.