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
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):
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?
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):
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?
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 ???
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"> </span><span class="tr corner"> </span><span class="bl corner"> </span><span class="br corner"> </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"> </div> </div> <span class="tl corner"> </span><span class="tr corner"> </span><span class="bl corner"> </span><span class="br corner"> </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" /> </a> <span class="tl corner"> </span><span class="tr corner"> </span><span class="bl corner"> </span><span class="br corner"> </span> </div> </div> Code (markup):
{/literal}{$baseurl}/image/{$p.PID}{literal}\">{/literal}{insert name=strip_special value=a assign=sharetitle text=$p.story}{$sharetitle}{literal} could this be it/
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):
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):
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):
one last thing is, is it possible to connect my facebook comment box to the fan page instead of my personal facebook page?
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
<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