Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Dec 2005
    Posts
    15
    Member #
    12094
    i'm setting up a comment script. it's written in PHP. it's set up and working just fine except it displays comments 5 per page. i'd like to keep it this way, but the links to advance the pages aren't working. instead, they point to a directory on my hard drive. how this even occured, i have no idea (i downloaded the script).

    http://www.alphadilettante.com/conte...discussion.php

    that's the page the script is included on.

    the actual script file is this:

    http://www.alphadilettante.com/conte...01/comment.php

    (the reason the comments don't show up on the comment.php page that are on the article-discussion.php page is because the .dat file the comments are written to can manage comments on various pages. thus, when you visit each page you will only see comments for that page (either comment.php or article-discussion.php))

    anyway, all the code is in comment.php. it works in article-discussion.php as a php include.

    the help site for this script is long gone. anybody got any insight on this?

    p.s. i'm willing to trade a little design work (graphic photoshop stuff, etc, i'm not a programmer) if someone can see a way to fix this. i know this is a lot of code.

    -- pablo

  2.  

  3. #2
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    Errr, we can't see any code. You're showing us links to php files, which can't be seen through a browser request, but only if you're sending us the actual file (usually by putting it in an archive).

    Your problem is probably relatively light. I'd be happy to help, and so will many others here, even without any prize of sorts.
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.

  4. #3
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    We need to see some of your code.

    The developer(s) may, and should have put some comments in place stating that they are going to use pagination to cycle through the comments if there are > 5.

    So to find the section we need you could do a Find for the terms "pagination" or "next", "previous" and similar.

  5. #4
    Junior Member
    Join Date
    Dec 2005
    Posts
    15
    Member #
    12094
    below is the code. i hope this is the way i'm supposed to post it up. the section of code is commented as "show comments". then it goes on to other sections. i am assuming that there is nothing wrong with the way the comments are being written to the .dat file because when one logs in to the admin section, all the comments show up nicely and going through several pages of comments works (in the admin section). but this is a seperate script (one script for commenting, one script for admin of the .dat file).

    PHP Code:
      // show comments:
      if (isset($_GET['show_comments'])) $show_comments = $_GET['show_comments'];
      if (isset($_POST['show_comments'])) $show_comments = $_POST['show_comments'];
      if (isset($show_comments) && isset($hide_comments)) unset($hide_comments);
      if (empty($hide_comments))
      {
      $comment_k = 0;
      $comment_a = 0;
      for ($i = 0; $i < $comment_total_entries; $i++)
        {
         $parts = explode("|", $data[$i]);
         if ($parts[3] == $comment_id)
          {
           $comment_k++;
           if ($parts[4] != "") $name = htmlentities(stripslashes(urldecode($parts[4]))); else $name = $comment_settings['anonym'];
           if ($parts[5] != "")
            {
             $email_hp = htmlentities(stripslashes(base64_decode(urldecode($parts[5]))));
             if (preg_match("/^[^@]+@.+\.\D{2,5}$/", $email_hp))
                 {
                  $email_parts = explode("@", $email_hp);
                  $email_name = $email_parts[0];
                  $email_domain_tld = $email_parts[1];
                  $domain_parts = explode(".", $email_domain_tld);
                  $email_domain = "";
                  for ($x = 0; $x < count($domain_parts)-1; $x++)
                   {
                    $email_domain .= $domain_parts[$x].".";
                   }
                  $email_tld = $domain_parts[$x];
                  $email_title = str_replace("[name]",$name,$comment_lang['email_title']);
                  $name = "<script type=\"text/javascript\">
                  <!--
                  document.write('<a href=\"mailto:');
                  document.write('".$email_name."');
                  document.write('@');
                  document.write('".$email_domain."');
                  document.write('".$email_tld."');
                  document.write('\" title=\"".$email_title."\">');
                  //-->
                  </script>".$name."<script type=\"text/javascript\">
                  <!--
                  document.write('</a>');
                  //-->
                  </script>";
                 }
              else
              {
               $hp_title = str_replace("[homepage]",$email_hp,$comment_lang['hp_title']);
               if (isset($comment_popup)) $name = '<a href="http://'.$email_hp.'" title="'.$hp_title.'" target="_blank">'.$name.'</a>';
               else $name = '<a href="http://'.$email_hp.'" title="'.$hp_title.'">'.$name.'</a>';
              }
            }
           $comment = htmlentities(stripslashes(urldecode($parts[6])));
           if (isset($comment_settings['wordwrap']) && $comment_settings['wordwrap'] != "") $comment = str_replace("\n", $comment_settings['wordwrap'], trim($comment));
           if (isset($comment_settings['auto_link']) && $comment_settings['auto_link']==true) $comment = comment_make_link($comment);
           $zeit = $parts[1];

           if ($comment_settings['add_comments'] == "top")
            {
             if ($comment_page=="show_all" || ($comment_k>($comment_page-1)*$comment_settings['comments_per_page'] && $comment_k<$comment_page*$comment_settings['comments_per_page']+1)) { ?><p style="margin:0px 0px 5px 0px;"><b><?php echo $name?>:</b>&nbsp;<?php echo $comment?><br /></p><?php $comment_a++; }
            }
           else
            {
             if (
    $comment_page=="show_all" || ($comment_k > ( ($comment_count-$comment_settings['comments_per_page']) - ( ($comment_page-1) * $comment_settings['comments_per_page'] ) ) && $comment_k < (($comment_count-$comment_settings['comments_per_page'])-(($comment_page-1)*$comment_settings['comments_per_page']))+($comment_settings['comments_per_page']+1))) { ?><p style="margin:0px 0px 5px 0px;"><b><?php echo $name?>:</b>&nbsp;<?php echo $comment?><br /></p><?php $comment_a++; }
            }
          }
        }

     
    $comments_shown str_replace("[comments]"$comment_a$comment_lang['comments_shown']);
     
    $comments_shown str_replace("[comments_total]"$comment_count$comments_shown);
     
    $comments_shown str_replace("[part]"$comment_page$comments_shown);
     if (
    $comment_k == 0) echo "<p><i>".$comment_lang['no_comments_yet']."</i></p>";
     if (
    $comment_settings['comments_per_page'] < $comment_count && $comment_page != "show_all") { ?><p style="margin:10px 0px 3px 0px; font-family: verdana, arial, sans-serif; font-size: 11px;"><?php echo $comments_shown?>&nbsp;<?php
     
    if ($comment_settings['comments_per_page'] < $comment_count && $comment_page 1) { ?>[ <a href="file:///C|/Documents%20and%20Settings/windowsxp/My%20Documents/user%20files/pablo%27s%20files/alphadilettante/materials/comment/<?php echo basename($_SERVER["PHP_SELF"]); ?>?comment_id=<?php echo $comment_id?>&comment_page=<?php echo $comment_page-1; if (isset($comment_popup)) echo "&amp;comment_popup=true"; if (isset($show_comments)) echo "&amp;show_comments=true"; echo $comment_settings['anker']; ?>" title="<?php echo $comment_lang['previous']; ?>">&laquo;</a> ] <?php }
     if (
    $comment_settings['comments_per_page'] < $comment_count && $comment_page < (($comment_count/$comment_settings['comments_per_page']))) { ?>[ <a href="file:///C|/Documents%20and%20Settings/windowsxp/My%20Documents/user%20files/pablo%27s%20files/alphadilettante/materials/comment/<?php echo basename($_SERVER["PHP_SELF"]); ?>?comment_id=<?php echo $comment_id?>&comment_page=<?php echo $comment_page+1; if (isset($comment_popup)) echo "&amp;comment_popup=true"; if (isset($show_comments)) echo "&amp;show_comments=true"; echo $comment_settings['anker']; ?>" title="<?php echo $comment_lang['next']; ?>">&raquo;</a> ] <?php }
     
    ?>
     [ <a href="file:///C|/Documents%20and%20Settings/windowsxp/My%20Documents/user%20files/pablo%27s%20files/alphadilettante/materials/comment/<?php echo basename($_SERVER["PHP_SELF"]); ?>?comment_id=<?php echo $comment_id?>&comment_page=show_all<?php if (isset($comment_popup)) echo "&amp;comment_popup=true"; if (isset($show_comments)) echo "&amp;show_comments=true"; echo $comment_settings['anker']; ?>" title="<?php echo $comment_lang['show_all']; ?>">*</a> ]</p><?php }
     if(isset(
    $errors))
      {
       
    ?><p style="color:red; font-weight:bold;"><?php echo $comment_lang['error']; ?></p><ul><?php foreach($errors as $f) { ?><li><?php echo $f?></li><?php ?></ul><?php
      
    }
     
    ?>
     <form method="post" action="<?php echo basename($_SERVER["file:///C|/Documents%20and%20Settings/windowsxp/My%20Documents/user%20files/pablo%27s%20files/alphadilettante/materials/comment/PHP_SELF"]); ?>"><div>
     <?php if (isset($comment_popup)) { ?><input type="hidden" name="comment_popup" value="true" /><?php ?>
     <input type="hidden" name="comment_id" value="<?php echo $comment_id?>" />
     <input type="hidden" name="show_comments" value="true" />
     <table style="margin-top: 10px;" border="0" cellpadding="1" cellspacing="0">
      <tr>
       <td colspan="3">
       <b><?php echo $comment_lang['add_comment']; ?></b><br />
       <textarea style="width: 400px;" name="comment_text" cols="45" rows="4"><?php if (isset($errors) && isset($_POST['comment_text'])) echo htmlentities(stripslashes($_POST['comment_text'])); ?></textarea><br />
       </td>
      </tr>
      <tr>
       <td style="font-family: verdana, arial, sans-serif; font-size: 11px; vertical-align: bottom;"><?php echo $comment_lang['name']; ?><br /><input type="text" name="name" value="<?php if (isset($errors) && isset($_POST['name'])) echo htmlentities(stripslashes($_POST['name'])); else echo ""?>" size="23" maxlength="25" /></td>
       <td style="font-family: verdana, arial, sans-serif; font-size: 11px; vertical-align: bottom;"><?php echo $comment_lang['email_hp']; ?><br/><input type="text" name="email_hp" value="<?php if (isset($errors) && isset($_POST['email_hp'])) echo htmlentities(stripslashes($_POST['email_hp'])); else echo ""?>" size="23" maxlength="60" /></td>
       <td style="font-family: verdana, arial, sans-serif; font-size: 11px; vertical-align: bottom;"><input type="submit" value="  <?php echo $comment_lang['ok']; ?>  " /></td>
      </tr>
     </table>
     </div></form>
     <?php
     
    }
     else
     {

      
    ?><p>[ <a href="file:///C|/Documents%20and%20Settings/windowsxp/My%20Documents/user%20files/pablo%27s%20files/alphadilettante/materials/comment/<?php echo basename($_SERVER['PHP_SELF']); ?>?show_comments=true<?php echo $comment_settings['anker']; ?>" title="<?php echo $comment_lang['comment_link_title']; ?>"><?php echo count_comments($comment_id1); ?></a> ]</p>
      <?php
     
    }
    thank you so much for any help. sorry about the tardiness of my reply, i was out of town for the weekend.

    -- pablo

    * edit *

    oh yes i forgot to mention, as i'm sure you can see anyway. the link to the files on my hard drive are right there in the code. like i said, i don't know much about php but this seems strange to me (how would that even end up in there?). i am guessing replacing that with some line of code would fix the problem. i just don't know what that would be.

  6. #5
    Senior Member raspberryh's Avatar
    Join Date
    Aug 2004
    Location
    Erie, PA
    Posts
    882
    Member #
    7208
    Liked
    1 times
    Yeah you'll definitely just need to go through that file and change all the places where it points to your local drive. Change everything that's like this:
    PHP Code:
    <?php echo basename($_SERVER["file:///C|/Documents%20and%20Settings/windowsxp/My%20Documents/user%20files/pablo%27s%20files/alphadilettante/materials/comment/PHP_SELF"]); ?>
    to this
    PHP Code:
    <?php echo basename($_SERVER["PHP_SELF"]); ?>
    choosy developers choose gif!
    website | paintings | blog


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 03:19 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com