1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

facebook comment box same on all pages

Discussion in 'Programming' started by kevydesigns, Jun 9, 2011.

  1. #1
    hi all,

    I have a facebook comment box..
    but the thing is, the comments that ppl write are the same on all pages.. is there a way to make each page unique? so that they can only comment on that page and nothing else?

    please help thankss

    my site is: plankings (dot) org
    thanks
     
    kevydesigns, Jun 9, 2011 IP
  2. RootShell

    RootShell Well-Known Member

    Messages:
    855
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    130
    Digital Goods:
    1
    #2
    Hi,

    If you want an independent Comment box for every page, you have to give the comment box the page full URL, not the web site URL, or the unique page ID.

    Example :
    Change this :
    <fb:comments href="http://example.com" num_posts="50" width="500"></fb:comments>
    Code (markup):
    to the following code :
    <fb:comments href="http://example.com/page1.html" num_posts="50" width="500"></fb:comments>
    Code (markup):
     
    RootShell, Jun 9, 2011 IP
  3. kevydesigns

    kevydesigns Well-Known Member

    Messages:
    1,209
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    125
    #3
    wow thanks, i thought about that.. but the thing is every page is unique, i wouldnt know what each url is because when the user uploads an image the url changes.. is there a way to use a variable?
     
    kevydesigns, Jun 9, 2011 IP
  4. RootShell

    RootShell Well-Known Member

    Messages:
    855
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    130
    Digital Goods:
    1
    #4
    Yup, you can use it
    or use this code if you are using PHP to get the unique page URL, place it before Comment box code :

    
    $pageURL = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";
    if ($_SERVER["SERVER_PORT"] != "80")
    {
        $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
    } 
    else 
    {
        $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
    }
    
    Code (markup):
    and in Facebook comment box :
    <fb:comments href="<?=$pageURL;?>" num_posts="50" width="500"></fb:comments>
    Code (markup):
    If not working try

    <fb:comments href="<?php echo $pageURL;?>" num_posts="50" width="500"></fb:comments>
    Code (markup):
     
    RootShell, Jun 9, 2011 IP
  5. kevydesigns

    kevydesigns Well-Known Member

    Messages:
    1,209
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    125
    #5
    Fatal error: Smarty error: [in view.tpl line 119]: syntax error: invalid attribute name: '.' (Smarty_Compiler.class.php, line 1510) in /home/xxxxxxx/public_html/plankings.org/smarty/libs/Smarty.class.php on line 1088

    could it be those {} tags that need to be included in a tpl file?
     
    kevydesigns, Jun 9, 2011 IP
  6. RootShell

    RootShell Well-Known Member

    Messages:
    855
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    130
    Digital Goods:
    1
    #6
    You are using Smarty :)
    I think you can't use PHP inside Smarty template files (.tpl)

    What is your Smarty version to give you the right code ???
     
    RootShell, Jun 9, 2011 IP
  7. kevydesigns

    kevydesigns Well-Known Member

    Messages:
    1,209
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    125
    #7
    Not sure how to check the version,
    but heres the code :

       <div id="bd">
    
    <h2 class="header">{$lang38}</h2>
                <div id="related" style="margin-bottom:20px;">	
                    <div id="related-container" style="margin-bottom:20px;">
                    	<center>
                        {section name=i loop=$mi}
                        {insert name=get_link value=var PID=$mi[i].PID assign=ptitle}
                        {insert name=get_title value=a title=$ptitle assign=mytitle}
                        <h3>{$mi[i].PID} {$mytitle}</h3>
                        <a href="{$baseurl}/image/{$mi[i].PID}{$ptitle}"><img alt="{$mi[i].PID} {$mytitle}" src="{$purl}/{$mi[i].PID}-t2{$mi[i].ext}" /></a>
    					{/section}            
                        <span class="tl corner">&nbsp;</span><span class="tr corner">&nbsp;</span><span class="bl corner">&nbsp;</span><span class="br corner">&nbsp;</span>
                        </center>
                    </div>
    <center>
    <script type="text/javascript"><!--
    google_ad_client = "pub-xxxxxxxxxxxxxxxxx";
    /* 728x15, created 6/9/11 */
    google_ad_slot = "7017714620";
    google_ad_width = 728;
    google_ad_height = 15;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    </center>
                </div>
    
    
           <div class="yui-g">
    			<div id="post-header">
                    <ul id="sharing">
                        <li>
                        	{literal}
    						<script language="javascript" type="text/javascript">
                            SHARETHIS.addEntry({
                                title:'{/literal}#{$p.PID}{literal}',
    							summary:'<a href=\"{/literal}{$baseurl}/image/{$p.PID}{literal}\">{/literal}{insert name=strip_special value=a assign=sharetitle text=$p.story}{$sharetitle}{literal}</a>',
    							content:'{/literal}{$imageurl}{literal}/logo.png',
    							url:'{/literal}{$baseurl}/image/{$p.PID}{literal}'
                            }, {button:true} );
                            </script>
                            {/literal}
                        </li>	
                    </ul>
                    <ul id="single-image-nav">
                    	{if $rand.PID ne ""}
                    	{insert name=get_link value=var PID=$rand.PID assign=rtitle}
                        <li class="nav"><a href="{$baseurl}/image/{$rand.PID}{$rtitle}" class="nav">{$lang25}</a></li>	
                        {/if}
                        {if $prev.PID ne ""}
                        {insert name=get_link value=var PID=$prev.PID assign=prtitle}	
                        <li class="nav"><a href="{$baseurl}/image/{$prev.PID}{$prtitle}" class="nav">{$lang22}</a></li>
                        {/if}
                        {if $next.PID ne ""}
                        {insert name=get_link value=var PID=$next.PID assign=ntitle}
                        <li class="nav"><a href="{$baseurl}/image/{$next.PID}{$ntitle}" class="nav">{$lang19}</a></li>
                        {/if}
                    </ul>
    			</div>
    
    
                <div id="post">                
                    <div id="image">
                    	{if $error ne ""}
                        <div class="error">{$error}</div>
                        {/if}
                        <div id="image-container">
                        	<center>
    						<a href="{if $next.PID ne ""}{$baseurl}/image/{$next.PID}{$ntitle}{elseif $rand.PID ne ""}{$baseurl}/image/{$rand.PID}{$rtitle}{/if}" id="single"><img alt="{insert name=get_stripped_phrase value=a assign=topcom details=$coms[0].details}{$topcom}" src="{$purl}/{$PID}{$p.ext}" /></a>			
                            </center>
    					</div>
    		
    					<div id="dashboard">			
                            <div id="interactive">
                                <div id="top-comment-voter">
                                    <strong>{$lang26}: </strong>
                                </div>
                        
                                <div class="rating-block" id="unit-776">
                                    <table>
                                        <tr>
                                            <td><strong>{$lang27}:</strong></td>
                                            <td class="block">
                                            	<div id="rateimage">
                                                    <ul class="unit-rating" style="width: 150px;">
                                                        <li class="current-rating" style="width: {insert name=get_rating value=a rating=$p.rating}px"></li>
                                                        {assign var=PRID value=pic`$p.PID`}
                                            			{if $smarty.cookies.$PRID eq "1"}
                                                        <li class="r1-unit">1</li>
                                                        <li class="r2-unit">2</li>
                                                        <li class="r3-unit">3</li>
                                                        <li class="r4-unit">4</li>
                                                        <li class="r5-unit">5</li>
                                                        {else}
                                                        <li><a class="r1-unit" href="javascript:loadContent('#rateimage', '{$baseurl}/rate.php?id={$p.PID}&rating=1')">1</a></li>
                                                        <li><a class="r2-unit" href="javascript:loadContent('#rateimage', '{$baseurl}/rate.php?id={$p.PID}&rating=2')">2</a></li>
                                                        <li><a class="r3-unit" href="javascript:loadContent('#rateimage', '{$baseurl}/rate.php?id={$p.PID}&rating=3')">3</a></li>
                                                        <li><a class="r4-unit" href="javascript:loadContent('#rateimage', '{$baseurl}/rate.php?id={$p.PID}&rating=4')">4</a></li>
                                                        <li><a class="r5-unit" href="javascript:loadContent('#rateimage', '{$baseurl}/rate.php?id={$p.PID}&rating=5')">5</a></li>
                                                        {/if}
                                                    </ul>
                                                    <p><small>{$lang39}: {$p.ratingcount}</small></p>
                                                </div>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
    
    
    
    
    
                            </div>	
    
    $pageURL = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";
    if ($_SERVER["SERVER_PORT"] != "80")
    {
        $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
    } 
    else 
    {
        $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
    }
    
                    
    <div id="facebook" style="background-color:#FFFFFF; padding-top:20px; margin-bottom:15px;">
                   <center>
    <fb:comments href="<?php echo $pageURL;?>" num_posts="50" width="500"></fb:comments>
                   </center>
    </div>	
    
                            <div class="clearer">&nbsp;</div>		
                                              
                           
                        </div>
                        <span class="tl corner">&nbsp;</span><span class="tr corner">&nbsp;</span><span class="bl corner">&nbsp;</span><span class="br corner">&nbsp;</span>
                    </div>		
                </div>
        
               
                {literal}
                <script language="javascript">
    			function changeClass1(){
    				document.getElementById("menu1").setAttribute("class", "inactive");
    				document.getElementById("menu2").setAttribute("class", "");
    			}
    			function changeClass2(){
    				document.getElementById("menu2").setAttribute("class", "inactive");
    				document.getElementById("menu1").setAttribute("class", "");
    			}
    			</script>
                {/literal}
                
                <a name="comanc" />&nbsp;</a>
                
                      
                   
        
                    <span class="tl corner">&nbsp;</span><span class="tr corner">&nbsp;</span><span class="bl corner">&nbsp;</span><span class="br corner">&nbsp;</span>
                </div>
            
                
       	
                    
                
            </div>
    Code (markup):
     
    kevydesigns, Jun 9, 2011 IP
  8. kevydesigns

    kevydesigns Well-Known Member

    Messages:
    1,209
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    125
    #8
    {/literal}{$baseurl}/image/{$p.PID}{literal}\">{/literal}{insert name=strip_special value=a assign=sharetitle text=$p.story}{$sharetitle}{literal}

    could this be it/
     
    kevydesigns, Jun 9, 2011 IP
  9. RootShell

    RootShell Well-Known Member

    Messages:
    855
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    130
    Digital Goods:
    1
    #9
    Replace the following code :

    $pageURL = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";
    if ($_SERVER["SERVER_PORT"] != "80")
    {
        $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
    } 
    else 
    {
        $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
    }
    
                    
    <div id="facebook" style="background-color:#FFFFFF; padding-top:20px; margin-bottom:15px;">
                   <center>
    <fb:comments href="<?php echo $pageURL;?>" num_posts="50" width="500"></fb:comments>
                   </center>
    Code (markup):
    With this code :

    <div id="facebook" style="background-color:#FFFFFF; padding-top:20px; margin-bottom:15px;">
                   <center>
    <fb:comments href="{$baseurl}/image/{$mi[i].PID}{$ptitle}" num_posts="50" width="500"></fb:comments>
    </center>
    Code (markup):
     
    RootShell, Jun 9, 2011 IP
  10. kevydesigns

    kevydesigns Well-Known Member

    Messages:
    1,209
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    125
    #10
    Doesn't seem to show the comment box..

    I tried this and it shows but still i can see the same comment on my other pages

    <div id="facebook" style="background-color:#FFFFFF; padding-top:20px; margin-bottom:15px;">
    <center>
    <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="{$baseurl}/image/{$mi[i].PID}{$ptitle}" num_posts="50" width="500"></fb:comments>
    
    </center> 
    </div>	
    Code (markup):
     
    kevydesigns, Jun 9, 2011 IP
  11. RootShell

    RootShell Well-Known Member

    Messages:
    855
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    130
    Digital Goods:
    1
    #11
    Can you give me your web site full URL after removing the comment box, to find the right variable
     
    RootShell, Jun 9, 2011 IP
  12. kevydesigns

    kevydesigns Well-Known Member

    Messages:
    1,209
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    125
    #12
    I removed the comment box already, it should appear on the bottom
     
    Last edited: Jun 9, 2011
    kevydesigns, Jun 9, 2011 IP
  13. RootShell

    RootShell Well-Known Member

    Messages:
    855
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    130
    Digital Goods:
    1
    #13
    Try this now :

    <div id="facebook" style="background-color:#FFFFFF; padding-top:20px; margin-bottom:15px;">
    <center>
    <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
    <fb:comments href="{$baseurl}/image/{$p.PID}" num_posts="50" width="500"></fb:comments>
    </center> 
    </div>
    Code (markup):
     
    RootShell, Jun 9, 2011 IP
  14. kevydesigns

    kevydesigns Well-Known Member

    Messages:
    1,209
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    125
    #14
    wow thanks it works now, rep +
     
    kevydesigns, Jun 9, 2011 IP
  15. RootShell

    RootShell Well-Known Member

    Messages:
    855
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    130
    Digital Goods:
    1
    #15
    Welcome ;)
     
    RootShell, Jun 9, 2011 IP
  16. kevydesigns

    kevydesigns Well-Known Member

    Messages:
    1,209
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    125
    #16
    one last thing is, is it possible to connect my facebook comment box to the fan page instead of my personal facebook page?
     
    kevydesigns, Jun 9, 2011 IP
  17. RootShell

    RootShell Well-Known Member

    Messages:
    855
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    130
    Digital Goods:
    1
    #17
    Yes, replace the page URL with your fan page URL ;)
    but the comments will be the same in all pages
     
    RootShell, Jun 9, 2011 IP
  18. kevydesigns

    kevydesigns Well-Known Member

    Messages:
    1,209
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    125
    #18
    no what i mean is

    <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
    that connects to my personal facebook page..
    but i want it to connect to the plankings dot org fanpage on facebook

    actually, or does it? :s
     
    kevydesigns, Jun 9, 2011 IP
  19. RootShell

    RootShell Well-Known Member

    Messages:
    855
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    130
    Digital Goods:
    1
    #19
    <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
    Code (markup):
    is the Facebook Javascript SDK, required to show some XFBML tages like fb:comments, and equipped with some functions.
    JS SDK don't have any relation with that
     
    RootShell, Jun 9, 2011 IP