1. Tired of not being able to see links? Want to chat with other members? Need help?

[Release] News Comments For UberCMS!

Discussion in 'CMS Releases' started by emo-nemo-321, Jan 17, 2012.

?

Did this work for you?

  1. Yeah! Thanks!

    77.8%
  2. No :L, Ill send you a PM

    33.3%
Multiple votes are allowed.
  1. emo-nemo-321

    emo-nemo-321 Member

    Hi devbest, usualy ive been seeing that people want the news comment sytem, but cant find it..
    Well, here you go! ENJOY!

    Ok, first off, open up your localhost/phpmyadmin and go to the SQL inject tab (after youve picked your DB, lol)
    Put this code in:
    Code:
    CREATE TABLE IF NOT EXISTS `site_news_comments` (
     
      `id` int(11) NOT NULL AUTO_INCREMENT,
     
      `article` int(11) NOT NULL,
     
      `userid` int(11) NOT NULL,
     
      `comment` varchar(500) NOT NULL,
     
      `posted_on` varchar(150) NOT NULL DEFAULT '',
     
      PRIMARY KEY (`id`)
     
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=294 ;  
    Great now thats done so open up your Comp-newsarticle.tpl and replace EVERYTHING with this:
    PHP:
    <?php
    $_SESSION
    ['id'] = $users->GetUserVar(USER_ID'id');
    ?>
    <div class="habblet-container ">
    <div class="cbb clearfix notitle ">
     
        <div id="article-wrapper">
     
            <h2>%news_article_title%</h2>
     
            <div class="article-meta">
            <?php if ($news_article_id 0) { ?>
                %news_article_date%
                %news_category%
            <?php ?>
            </div>
     
            <?php if (strlen(trim($news_article_summary)) > 0) { ?>
            <p class="summary">
     
                %news_article_summary%
     
            </p>
            <?php ?>
     
            <div class="article-body">
     
                %news_article_body%
     
            </div>
     
            <?php if ($news_article_id 0) { ?>
            <script type="text/javascript" language="Javascript">
                document.observe("dom:loaded", function() {
                    $$('.article-images a').each(function(a) {
                        Event.observe(a, 'click', function(e) {
                            Event.stop(e);
                            Overlay.lightbox(a.href, "Image is loading");
                        });
                    });
     
                    $$('a.article-%news_article_id%').each(function(a) {
                        a.replace(a.innerHTML);
                    });
                });
            </script>
            <?php ?>
     
        </div>
     
    </div>
    </div>
    <?php
    if(isset($_POST['post_comment']))
      
    $posted_on date("M j, Y g:i A");
    if (! isset(
    $_POST['comment'])) {
      
    $_POST['comment'] = '';  // nu bestaat de variabele ten minste
    }
     
    $comment strip_tags ($_POST['comment']);
    if(
    $comment == NULL){
        
    $error_message 'You have left a field empty.<br /><br />';
      }else{
    if (
    LOGGED_IN)
    {
        
    mysql_query("INSERT INTO site_news_comments (article, userid, comment, posted_on) VALUES ('".
     
    $news_article_id."', '".$_SESSION['id']."', '".$comment."', '".$posted_on."');");
        
    $error_message 'You have successfully left a comment.<br /><br />';
      }
    }
    ?>
     
    <div class="habblet-container ">
      <div class="cbb clearfix notitle ">
        <div id="article-wrapper"><h2>Post a comment!</h2>
          <div class="article-meta"></div>
          <div class="article-body">
            <form action="" method="post">
            <textarea name="comment" maxlength="500"></textarea><br /><br />
            <input type="submit" name="post_comment" value="Post a comment!" />
            </form>
          </div>
        </div>
      </div>
    </div>
    <style type="text/css">
    input[type="text"], input[type="password"] {
      background-color: #F1F1F1;
      border: 1px solid #999999;
      width: 175px;
      padding: 5px;
      font-family: verdana;
      font-size: 10px;
      color: #666666;
    }
    input[type="submit"] {
      background-color: #F1F1F1;
      border: 1px solid #999999;
      padding: 5px;
      font-family: verdana;
      font-size: 10px;
      color: #666666;
    }
    textarea {
      background-color: #F1F1F1;
      border: 1px solid #999999;
      padding: 5px;
      width: 517px;
      height: 70px;
      font-family: verdana;
      font-size: 10px;
      color: #666666;
    }
    select {
      background-color: #F1F1F1;
      border: 1px solid #999999;
      padding: 5px;
      font-family: verdana;
      font-size: 10px;
      color: #666666;
    }
    </style>
    <?php
    $getComments 
    mysql_query("SELECT * FROM site_news_comments WHERE article = '".$news_article_id."' ORDER by
     
    id DESC"
    );
    ?>
    <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(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://www.habbo.com/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://www.ferbo.nl/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>';
            }
            
    ?>
          </div>
        </div>
      </div>
    </div>
    </div>
                    <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) {
     
    Rounder.init(); }</script>
    There you go! :D
    ====================================================================
    Screenie:[ Want to see this link? Register ! ]
    Credis to Yabsoon from ******* Forums
     
  2. Quirky

    Quirky Member

    Screenies?/
     
  3. Thom

    Thom You can't touch this

    Post some screenshots please and give credits to the creator. Thanks.
     
  4. emo-nemo-321

    emo-nemo-321 Member

    *updated*
     
  5. LoW

    LoW Graphic Artist

    Updated?
    Please put some Screenies!
     
  6. emo-nemo-321

    emo-nemo-321 Member

    I did :L
     
  7. brsy

    brsy fiverr.com/criesval

    Nice release! Is it actually secured?
     
  8. emo-nemo-321

    emo-nemo-321 Member

    should be :L
     
  9. LoW

    LoW Graphic Artist

    Ohh Great! Thanks for this XD
     
  10. James6213

    James6213 Member

    Try code it for RevCMS thanks.
     
    Cobra likes this.

Share This Page

Loading...