Am I doing this right?

Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    Loyalty Vaulient is offline
    MemberRank
    May 2012 Join Date
    MalaysiaLocation
    1,796Posts

    Re: Am I doing this right?

    Quote Originally Posted by iRetro™ View Post
    I'll add this to my site, with some edits and then I'll release. UberCMS only.
    Alright mate , hopefully someone can fix it

  2. #17
    Account Upgraded | Title Enabled! iRetro™ is offline
    MemberRank
    Feb 2010 Join Date
    United KingdomLocation
    558Posts

    Re: Am I doing this right?

    I've edited around with this code and I'm happy with the outcome.


    To fix your problem just replace $articleid with $news_article_id.

  3. #18
    Account Upgraded | Title Enabled! flx5 is offline
    MemberRank
    Nov 2009 Join Date
    GMT+1Location
    294Posts

    Re: Am I doing this right?

    Quote Originally Posted by iRetro™ View Post
    I've edited around with this code and I'm happy with the outcome.


    To fix your problem just replace $articleid with $news_article_id.
    Well those are the errors noone thinks about, if not looking at the full CMS :)

  4. #19
    Loyalty Vaulient is offline
    MemberRank
    May 2012 Join Date
    MalaysiaLocation
    1,796Posts

    Re: Am I doing this right?

    Quote Originally Posted by iRetro™ View Post
    I've edited around with this code and I'm happy with the outcome.


    To fix your problem just replace $articleid with $news_article_id.
    Ok so now the comments are shown , but not all of them , it's stuck at 5 comment when there's suppoase to be 7 of them.

    Also

    Screenshot by Lightshot

    I don't understand why first is clickable when I am on the first page of the comments , and hwne I click on first , it goes to this link

    habjo.in/articles/articles?id=13&page=1

    and it becomes like this Screenshot by Lightshot
    Last edited by Vaulient; 14-12-13 at 01:47 AM.

  5. #20
    C# / while (!asleep); N0tis is offline
    MemberRank
    Aug 2011 Join Date
    258Posts

    Re: Am I doing this right?

    Use this:

    Code:
    <?php
    $getComments = dbquery("SELECT * FROM site_news_comments WHERE article='" . $news_article_id . "'");
    $page = 0;
    if(isset($_GET['page']))
    $count = mysql_num_rows($getComments);
    $page = abs((int) $_GET['page']);
    $min_comments = $page * 5;
    $max_comments = $min_comments + 7;
    $getComments = dbquery("SELECT * FROM site_news_comments WHERE article = '" . $news_article_id . "' ORDER BY id ASC LIMIT $min_comments, $max_comments");
    ?>
    <div class="habblet-container ">
      <div class="cbb clearfix notitle ">
        <div id="article-wrapper"><h2>Comments (<?php echo mysql_num_rows($getComments); ?>)</h2>
          <div class="article-meta"></div>
          <div class="article-body">
            <?php
                    if ($page == 1)
                {
                    echo "First&nbsp;&nbsp;";
                }
                 
                else
                {
                    echo "<a href='http://habjo.in/articles?id=" . $news_article_id . "&page=" . 1 . "'>First</a>&nbsp;&nbsp;";
                }
     
    for ($i = 1; $i <= $pages; $i++)
            {
                if (($page + 4) >= $i && ($page - 4) <= $i)
                {
                    if ($i != $page)
                    {
                        echo'<a name="pages" href="http://habjo.in/articles?id=' . $news_article_id . '&page='.$i.'">'.$i.'</a>&nbsp;&nbsp;';
                    }
                    else  
                    {  
                        echo "<b>" . $i . "</b>&nbsp;&nbsp;";  
                    }  
                }
            }
                if ($page == $pages)
                {
                    echo "Last";
                }
                 
                else
                {
                    echo "<a href='http://habjo.in/article.php?id=" . $news_article_id . "&page=" . $pages . "'>Last</a>";
                }  
            if(mysql_num_rows($getComments) == 0){
              echo 'Sorry, er zijn nog geen Reacties geplaatst!';
            }else{
              echo '<table width="528px">';
              while($Comments = mysql_fetch_array($getComments)){
              $getUserInfo = mysql_query("SELECT * FROM users WHERE id = '".$Comments['userid']."'");
              $userInfo = mysql_fetch_array($getUserInfo);
                      echo '
                      <tr>
                        <td width="90px" valign="top">
                          <div style="float:left"><img src="http://habbo.nl/habbo-imaging/avatarimage?figure='.$userInfo['look'].'&size=b&direction=2&head_direction=3&gesture=sml&size=s"></div>
                          ';
                          if($userInfo['rank'] > 8){
                            echo '<div style="position: absolute; z-index:1"><img
     
    src="http://127.0.0.1/swfs/c_images/album1584/AD1.gif"></div>';
                        }
                    echo '
                    </td>
                        <td width="427px" valign="top">
                          <strong>RE: %news_article_title%</strong><br /><br />'.$Comments['comment'].'
                        </td>
                      </tr>
              <tr>
                        <td width="90px" valign="top">
                        </td>
                <td width="427px" align="right">
                  <i>Posted by: <strong><a href="#">'.$userInfo['username'].'</a></strong>  On '.$Comments
     
    ['posted_on'].'</i><br /><br />
                </td>
              </tr>';
              }
              echo '</table>';
            }
            ?>

  6. #21
    Loyalty Vaulient is offline
    MemberRank
    May 2012 Join Date
    MalaysiaLocation
    1,796Posts

    Re: Am I doing this right?

    Quote Originally Posted by Jerking View Post
    Use this:

    Code:
    <?php
    $getComments = dbquery("SELECT * FROM site_news_comments WHERE article='" . $news_article_id . "'");
    $page = 0;
    if(isset($_GET['page']))
    $count = mysql_num_rows($getComments);
    $page = abs((int) $_GET['page']);
    $min_comments = $page * 5;
    $max_comments = $min_comments + 7;
    $getComments = dbquery("SELECT * FROM site_news_comments WHERE article = '" . $news_article_id . "' ORDER BY id ASC LIMIT $min_comments, $max_comments");
    ?>
    <div class="habblet-container ">
      <div class="cbb clearfix notitle ">
        <div id="article-wrapper"><h2>Comments (<?php echo mysql_num_rows($getComments); ?>)</h2>
          <div class="article-meta"></div>
          <div class="article-body">
            <?php
                    if ($page == 1)
                {
                    echo "First  ";
                }
                 
                else
                {
                    echo "<a onclick="ga('send', 'event', 'Outgoing', 'habjo.in', '/articles?id=');" rel='nofollow' href='http://habjo.in/articles?id=" . $news_article_id . "&page=" . 1 . "'>First</a>  ";
                }
     
    for ($i = 1; $i <= $pages; $i++)
            {
                if (($page + 4) >= $i && ($page - 4) <= $i)
                {
                    if ($i != $page)
                    {
                        echo'<a onclick="ga('send', 'event', 'Outgoing', 'habjo.in', '/articles?id=');" rel="nofollow" name="pages" href="http://habjo.in/articles?id=' . $news_article_id . '&page='.$i.'">'.$i.'</a>  ';
                    }
                    else  
                    {  
                        echo "<b>" . $i . "</b>  ";  
                    }  
                }
            }
                if ($page == $pages)
                {
                    echo "Last";
                }
                 
                else
                {
                    echo "<a onclick="ga('send', 'event', 'Outgoing', 'habjo.in', '/article.php?id=');" rel='nofollow' href='http://habjo.in/article.php?id=" . $news_article_id . "&page=" . $pages . "'>Last</a>";
                }  
            if(mysql_num_rows($getComments) == 0){
              echo 'Sorry, er zijn nog geen Reacties geplaatst!';
            }else{
              echo '<table width="528px">';
              while($Comments = mysql_fetch_array($getComments)){
              $getUserInfo = mysql_query("SELECT * FROM users WHERE id = '".$Comments['userid']."'");
              $userInfo = mysql_fetch_array($getUserInfo);
                      echo '
                      <tr>
                        <td width="90px" valign="top">
                          <div style="float:left"><img src="http://habbo.nl/habbo-imaging/avatarimage?figure='.$userInfo['look'].'&size=b&direction=2&head_direction=3&gesture=sml&size=s"></div>
                          ';
                          if($userInfo['rank'] > 8){
                            echo '<div style="position: absolute; z-index:1"><img
     
    src="http://127.0.0.1/swfs/c_images/album1584/AD1.gif"></div>';
                        }
                    echo '
                    </td>
                        <td width="427px" valign="top">
                          <strong>RE: %news_article_title%</strong><br /><br />'.$Comments['comment'].'
                        </td>
                      </tr>
              <tr>
                        <td width="90px" valign="top">
                        </td>
                <td width="427px" align="right">
                  <i>Posted by: <strong><a href="#">'.$userInfo['username'].'</a></strong>  On '.$Comments
     
    ['posted_on'].'</i><br /><br />
                </td>
              </tr>';
              }
              echo '</table>';
            }
            ?>
    It displays my comments .. but yet Screenshot by Lightshot it's selected on last , and it doesn't paginate

  7. #22
    Check http://arcturus.pw The General is offline
    DeveloperRank
    Aug 2011 Join Date
    7,607Posts

    Re: Am I doing this right?

    Quote Originally Posted by iRetro™ View Post
    I seriously wonder why people would want to play a retro in which their owner can't even understand simple PHP.

    There was a little typo in this code so replace it with this.
    Code:
    <?php
    $getComments = dbquery("SELECT * FROM site_news_comments WHERE article='" . $articleid . "'");
    $page = 0;
    if(isset($_GET['page']))
    $count = mysql_num_rows($getComments); 
    $page = abs((int) $_GET['page']);
    $min_comments = $page * 5;
    $max_comments = $min_comments + 5;
    $getComments = dbquery("SELECT * FROM site_news_comments WHERE article = '" . $articleid . "' ORDER BY id ASC LIMIT $min_comments, $max_comments");
    ?>
    Made it all up. Did not test anything so typos might have occurred. Anyways thanks for pointing out.



Page 2 of 2 FirstFirst 12

Advertisement