boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Comments Disappeared on Main Blog!

 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
kenya



Joined: 27 Sep 2003
Posts: 5

PostPosted: Thu Jun 10, 2004 4:06 pm    Post subject: Comments Disappeared on Main Blog! Reply with quote

I did something and my comments have disappeared.
I tried using a commenter's hack and put the call function in index.php. I then cut and paste the code in b2template.functions.php. Anyway, it didn't work well, so I uploaded the original version of b2template.functions.php and then cut the call function in index.php.

Strangely, I have lost my comments. Can someone look at the code or tell me what I should do? Thanks! Kenya

INDEX.PHP snippet:
Code:
<?php the_date("","<h2>","</h2>"); ?>
<?php permalink_anchor(); ?>
<div class="storyTitle"><?php the_title(); ?>
   <a href="?cat=<?php the_category_ID() ?>" title="category: <?php the_category() ?>"><span class="storyCategory">[<?php the_category() ?>]</span></a> - 
<span class="storyAuthor"><a href="http://www.black-poetry.com/blog/b2team.php"><?php the_author() ?></a>

- <?php the_author_email() ?></span> @ <?php the_time() ?></a>
</div>

<div class="storyContent">
<?php the_content(); ?>

<div class="leftFlush">
<?php link_pages("<br />Pages: ","<br />","number") ?> <?php comments_popup_link("comments ?", "1 comment", "% comments") ?>
<?php include ("b2comments.php"); ?>
</div>

</div>


<!-- // this is just the end of the motor - don't touch that line either :) -->
   <?php } ?>


</div>






THIS IS FROM B2TEMPLATE.FUNCTIONS.PHP:
Code:
   $querycount++;
   echo "<select name=\"cat\" class=\"postform\">\n";
   if (intval($optionall) == 1) {
      echo "\t<option value=\"all\">$all</option>\n";
   }
   while($row = mysql_fetch_object($result)) {
      echo "\t<option value=\"".$row->cat_ID."\"";
      if ($row->cat_ID == $cat)
         echo " selected";
      echo ">".stripslashes($row->cat_name)."</option>\n";
   }
   echo "</select>\n";
}

// out of the b2 loop
function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = 'blah') {
   global $tablecategories,$querycount;
   global $pagenow;
   $file = ($file == 'blah') ? $pagenow : $file;
   $sort_column = 'cat_'.$sort_column;
   $query="SELECT * FROM $tablecategories WHERE cat_ID > 0 ORDER BY $sort_column $sort_order";
   $result=mysql_query($query);
   $querycount++;
   if (intval($optionall) == 1) {
      echo "\t<a href=\"$file?cat=all\">$all</a><br />\n";
   }
   while($row = mysql_fetch_object($result)) {
      echo "\t<a href=\"$file?cat=".$row->cat_ID."\">";
      echo stripslashes($row->cat_name)."</a><br />\n";
   }
}

/***** // Category tags *****/




/***** Comment tags *****/

function comments_number($zero='no comment', $one='1 comment', $more='% comments') {
   // original hack by [email protected]
   global $id,$postdata,$tablecomments,$c,$querycount,$cache_commentsnumber,$use_cache;
   if (empty($cache_commentsnumber[$id]) OR (!$use_cache)) {
      $query="SELECT * FROM $tablecomments WHERE comment_post_ID = $id";
      $result=mysql_query($query);
      $number=mysql_num_rows($result);
      $querycount++;
      $cache_commentsnumber[$id] = $number;
   } else {
      $number = $cache_commentsnumber[$id];
   }
   if ($number == 0) {
      $blah = $zero;
   } elseif ($number == 1) {
      $blah = $one;
   } elseif ($number  > 1) {
      $n = $number;
      $more=str_replace('%', $n, $more);
      $blah = $more;
   }
   echo $blah;
}

function comments_link($file='') {
   global $id,$pagenow;
   if ($file == '')   $file = $pagenow;
   if ($file == '/')   $file = '';
   echo $file."?p=$id&c=1#comments";
}

function comments_popup_script($width=400, $height=400, $file='b2commentspopup.php') {
   global $b2commentspopupfile, $b2commentsjavascript;
   $b2commentspopupfile = $file;
   $b2commentsjavascript = 1;
   $javascript = "<script language=\"javascript\" type=\"text/javascript\">\n<!--\nfunction b2comments (macagna) {\n    window.open(macagna, '_blank', 'width=$width,height=$height,scrollbars=yes,status=yes');\n}\n//-->\n</script>\n";
   echo $javascript;
}

function comments_popup_link($zero='no comment', $one='1 comment', $more='% comments', $CSSclass='') {
   global $b2commentspopupfile, $b2commentsjavascript;
   echo '<a href="';
   if ($b2commentsjavascript) {
      comments_link($b2commentspopupfile);
      echo '" onclick="b2comments(this.href); return false"';
   } else {
      // if comments_popup_script() is not in the template, display simple comment link
      comments_link();
   }
   if (!empty($CSSclass)) {
      echo ' class="'.$CSSclass.'"';
   }
   echo '>';
   comments_number($zero, $one, $more);
   echo '</a>';
}

function comment_ID() {
   global $commentdata;   echo $commentdata["comment_ID"];
}

function comment_author() {
   global $commentdata;   echo stripslashes($commentdata['comment_author']);
}

function comment_author_email() {
   global $commentdata;   echo antispambot(stripslashes($commentdata["comment_author_email"]));
}

function comment_author_url() {
   global $commentdata;   echo stripslashes($commentdata["comment_author_url"]);
}

function comment_author_email_link($linktext="",$before="",$after="") {
   global $commentdata;
   $email=$commentdata["comment_author_email"];
   if ((!empty($email)) && ($email != "@")) {
      $display = ($linktext != "") ? $linktext : antispambot(stripslashes($email));
      echo $before;
      echo "<a href=\"mailto:".antispambot(stripslashes($email))."\">$display</a>";
      echo $after;
   }
}

function comment_author_url_link($linktext="",$before="",$after="") {
   global $commentdata;
   $url=$commentdata["comment_author_url"];
   if ((!empty($url)) && ($url != "http://")) {
      $display = ($linktext != "") ? $linktext : stripslashes($url);
      echo $before;
      echo "<a href=\"".stripslashes($url)."\" target=\"_blank\">$display</a>";
      echo $after;
   }
}

function comment_author_IP() {
   global $commentdata;   echo stripslashes($commentdata["comment_author_IP"]);
}

function comment_text() {
   global $commentdata;
   $comment = stripslashes($commentdata["comment_content"]);
   $comment = convert_chars($comment);
   $comment = convert_bbcode($comment);
   $comment = convert_gmcode($comment);
   $comment = convert_smilies($comment);
   $comment = make_clickable($comment);
   $comment = balanceTags($comment);
   echo $comment;
}

function comment_date($d="") {
   global $commentdata,$dateformat;
   if ($d == "") {
      echo mysql2date($dateformat, $commentdata["comment_date"]);
   } else {
      echo mysql2date($d, $commentdata["comment_date"]);
   }
}

function comment_time($d="") {
   global $commentdata,$timeformat;
   if ($d == "") {
      echo mysql2date($timeformat, $commentdata["comment_date"]);
   } else {
      echo mysql2date($d, $commentdata["comment_date"]);
   }
}

/***** // Comment tags *****/




/***** Permalink tags *****/

function permalink_anchor() {
   global $id;   echo "<a name=\"$id\"></a>";
}

function permalink_link($file="") {
   global $id,$postdata,$pagenow;
   if ($file=="")
      $file=$pagenow;
   $archive_mode = get_settings("archive_mode");
   if ($archive_mode == "monthly") {
      echo $file."?m=".substr($postdata["Date"],0,4).substr($postdata["Date"],5,2)."#$id";
   } elseif ($archive_mode == "weekly") {
      echo $file."?w=".substr($postdata["Date"],0,4).substr($postdata["Date"],5,2)."#$id";
   } elseif ($archive_mode == "postbypost") {
      echo $file."?p=$id";
   }
}

function permalink_single($file="") {
   global $id,$postdata,$pagenow;
   if ($file=="")
      $file=$pagenow;
   echo $file."?p=$id&c=1";
}

function permalink_single_rss($file="b2rss.xml") {
   global $id,$postdata,$pagenow,$siteurl,$blogfilename;
      echo $siteurl."/".$blogfilename."?p=$id&c=1";
}

/***** // Permalink tags *****/




// @@@ These aren't template tags, do not edit them

function start_b2() {
   global $row, $id, $postdata, $authordata, $day, $preview, $page, $pages, $multipage, $more, $numpages;
   global $preview_userid,$preview_date,$preview_content,$preview_title,$preview_category,$preview_notify,$preview_make_clickable,$preview_autobr;
   global $HTTP_GET_VARS;
   if (!$preview) {
      $id = $row->ID;
      $postdata=get_postdata2($id);
   } else {
      $id = 0;
      $postdata = array (
         "ID" => 0,
         "Author_ID" => $HTTP_GET_VARS["preview_userid"],
         "Date" => $HTTP_GET_VARS["preview_date"],
         "Content" => $HTTP_GET_VARS["preview_content"],
         "Title" => $HTTP_GET_VARS["preview_title"],
         "Category" => $HTTP_GET_VARS["preview_category"],
         "Notify" => 1,
         "Clickable" => 1,
         "Karma" => 0 // this isn't used yet
         );
      if (!empty($HTTP_GET_VARS["preview_autobr"])) {
         $postdata["Content"] = autobrize($postdata["Content"]);
      }
   }
   $authordata = get_userdata($postdata["Author_ID"]);
   $day = mysql2date("d.m.y",$postdata["Date"]);
   $currentmonth = mysql2date("m",$postdata["Date"]);
   $numpages=1;
   if (!$page)
      $page=1;
   if (isset($p))
      $more=1;
   $content = $postdata["Content"];
   if (preg_match("/<!--nextpage-->/",$postdata["Content"])) {
      if ($page > 1)
         $more=1;
      $multipage="1";
      $content=stripslashes($postdata["Content"]);
      $content = str_replace("\n<!--nextpage-->\n","<!--nextpage-->",$content);
      $content = str_replace("\n<!--nextpage-->","<!--nextpage-->",$content);
      $content = str_replace("<!--nextpage-->\n","<!--nextpage-->",$content);
      $pages=explode("<!--nextpage-->",$content);
      $numpages=count($pages);
   } else {
      $pages[0]=stripslashes($postdata["Content"]);
      $multipage=0;
   }
   return true;
}

function is_new_day() {
   global $day, $previousday;
   if ($day != $previousday) {
      return(1);
   } else {
      return(0);
   }
}

?>
Back to top
View user's profile Send private message
Sigg3



Joined: 03 Jul 2003
Posts: 616
Location: Oslo, Norway

PostPosted: Fri Jun 11, 2004 8:02 am    Post subject: Reply with quote

<?php comments_popup_link("comments ?", "1 comment", "% comments") ?>

and <?php include ("b2comments.php"); ?>

??

Are you using both the pop-up and the integrated comments? If you want pop-ups, remove that second line and remember to add the pop-up tag in your <head> section of index.php. If not, replace comments_popup_link with comments_link (or what'sitcalled).

I dunno.
_________________
Sigg3 dot net - because you're worth it! | b2 Cafelog Resource Center
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group