Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Releases
CMS Releases
[Release] News Comments For UberCMS!
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="emo-nemo-321" data-source="post: 67414" data-attributes="member: 11618"><p>Hi devbest, usualy ive been seeing that people want the news comment sytem, but cant find it..</p><p>Well, here you go! ENJOY!</p><p> </p><p>Ok, first off, open up your localhost/phpmyadmin and go to the SQL inject tab (after youve picked your DB, lol)</p><p>Put this code in:</p><p>[CODE]CREATE TABLE IF NOT EXISTS `site_news_comments` (</p><p> </p><p> `id` int(11) NOT NULL AUTO_INCREMENT,</p><p> </p><p> `article` int(11) NOT NULL,</p><p> </p><p> `userid` int(11) NOT NULL,</p><p> </p><p> `comment` varchar(500) NOT NULL,</p><p> </p><p> `posted_on` varchar(150) NOT NULL DEFAULT '',</p><p> </p><p> PRIMARY KEY (`id`)</p><p> </p><p>) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=294 ; [/CODE]</p><p>Great now thats done so open up your Comp-newsarticle.tpl and replace <strong><u>EVERYTHING</u></strong> with this:</p><p>[PHP]<?php</p><p>$_SESSION['id'] = $users->GetUserVar(USER_ID, 'id');</p><p>?></p><p><div class="habblet-container "></p><p><div class="cbb clearfix notitle "></p><p> </p><p> <div id="article-wrapper"></p><p> </p><p> <h2>%news_article_title%</h2></p><p> </p><p> <div class="article-meta"></p><p> <?php if ($news_article_id > 0) { ?></p><p> %news_article_date%</p><p> %news_category%</p><p> <?php } ?></p><p> </div></p><p> </p><p> <?php if (strlen(trim($news_article_summary)) > 0) { ?></p><p> <p class="summary"></p><p> </p><p> %news_article_summary%</p><p> </p><p> </p></p><p> <?php } ?></p><p> </p><p> <div class="article-body"></p><p> </p><p> %news_article_body%</p><p> </p><p> </div></p><p> </p><p> <?php if ($news_article_id > 0) { ?></p><p> <script type="text/javascript" language="Javascript"></p><p> document.observe("dom:loaded", function() {</p><p> $$('.article-images a').each(function(a) {</p><p> Event.observe(a, 'click', function(e) {</p><p> Event.stop(e);</p><p> Overlay.lightbox(a.href, "Image is loading");</p><p> });</p><p> });</p><p> </p><p> $$('a.article-%news_article_id%').each(function(a) {</p><p> a.replace(a.innerHTML);</p><p> });</p><p> });</p><p> </script></p><p> <?php } ?></p><p> </p><p> </div></p><p> </p><p></div></p><p></div></p><p><?php</p><p>if(isset($_POST['post_comment']))</p><p> $posted_on = date("M j, Y g:i A");</p><p>if (! isset($_POST['comment'])) {</p><p> $_POST['comment'] = ''; // nu bestaat de variabele ten minste</p><p>}</p><p> </p><p>$comment = strip_tags ($_POST['comment']);</p><p>if($comment == NULL){</p><p> $error_message = 'You have left a field empty.<br /><br />';</p><p> }else{</p><p>if (LOGGED_IN)</p><p>{</p><p> mysql_query("INSERT INTO site_news_comments (article, userid, comment, posted_on) VALUES ('".</p><p> </p><p>$news_article_id."', '".$_SESSION['id']."', '".$comment."', '".$posted_on."');");</p><p> $error_message = 'You have successfully left a comment.<br /><br />';</p><p> }</p><p>}</p><p>?></p><p> </p><p><div class="habblet-container "></p><p> <div class="cbb clearfix notitle "></p><p> <div id="article-wrapper"><h2>Post a comment!</h2></p><p> <div class="article-meta"></div></p><p> <div class="article-body"></p><p> <form action="" method="post"></p><p> <textarea name="comment" maxlength="500"></textarea><br /><br /></p><p> <input type="submit" name="post_comment" value="Post a comment!" /></p><p> </form></p><p> </div></p><p> </div></p><p> </div></p><p></div></p><p><style type="text/css"></p><p>input[type="text"], input[type="password"] {</p><p> background-color: #F1F1F1;</p><p> border: 1px solid #999999;</p><p> width: 175px;</p><p> padding: 5px;</p><p> font-family: verdana;</p><p> font-size: 10px;</p><p> color: #666666;</p><p>}</p><p>input[type="submit"] {</p><p> background-color: #F1F1F1;</p><p> border: 1px solid #999999;</p><p> padding: 5px;</p><p> font-family: verdana;</p><p> font-size: 10px;</p><p> color: #666666;</p><p>}</p><p>textarea {</p><p> background-color: #F1F1F1;</p><p> border: 1px solid #999999;</p><p> padding: 5px;</p><p> width: 517px;</p><p> height: 70px;</p><p> font-family: verdana;</p><p> font-size: 10px;</p><p> color: #666666;</p><p>}</p><p>select {</p><p> background-color: #F1F1F1;</p><p> border: 1px solid #999999;</p><p> padding: 5px;</p><p> font-family: verdana;</p><p> font-size: 10px;</p><p> color: #666666;</p><p>}</p><p></style></p><p><?php</p><p>$getComments = mysql_query("SELECT * FROM site_news_comments WHERE article = '".$news_article_id."' ORDER by</p><p> </p><p>id DESC");</p><p>?></p><p><div class="habblet-container "></p><p> <div class="cbb clearfix notitle "></p><p> <div id="article-wrapper"><h2>Comments (<?php echo mysql_num_rows($getComments); ?>)</h2></p><p> <div class="article-meta"></div></p><p> <div class="article-body"></p><p> <?php</p><p> if(mysql_num_rows($getComments) == 0){</p><p> echo 'Sorry, er zijn nog geen Reacties geplaatst!';</p><p> }else{</p><p> echo '<table width="528px">';</p><p> while($Comments = mysql_fetch_array($getComments)){</p><p> $getUserInfo = mysql_query("SELECT * FROM users WHERE id = '".$Comments['userid']."'");</p><p> $userInfo = mysql_fetch_array($getUserInfo);</p><p> echo '</p><p> <tr></p><p> <td width="90px" valign="top"></p><p> <div style="float:left"><img src="http://www.habbo.com/habbo-imaging/avatarimage?</p><p> </p><p>figure='.$userInfo['look'].'&size=b&direction=2&head_direction=3&gesture=sml&size=s"></div></p><p> ';</p><p> if($userInfo['rank'] > 8){</p><p> echo '<div style="position: absolute; z-index:1"><img</p><p> </p><p>src="http://www.ferbo.nl/c_images/album1584/AD1.gif"></div>';</p><p> }</p><p> echo '</p><p> </td></p><p> <td width="427px" valign="top"></p><p> <strong>RE: %news_article_title%</strong><br /><br />'.$Comments['comment'].'</p><p> </td></p><p> </tr></p><p> <tr></p><p> <td width="90px" valign="top"></p><p> </td></p><p> <td width="427px" align="right"></p><p> <i>Posted by: <strong><a href="#">'.$userInfo['username'].'</a></strong> On '.$Comments</p><p> </p><p>['posted_on'].'</i><br /><br /></p><p> </td></p><p> </tr>';</p><p> }</p><p> echo '</table>';</p><p> }</p><p> ?></p><p> </div></p><p> </div></p><p> </div></p><p></div></p><p></div></p><p> <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) {</p><p> </p><p>Rounder.init(); }</script>[/PHP]</p><p>There you go! <img src="/styles/default/xenforo/smilies/emojione/biggrin.png" class="smilie" loading="lazy" alt=":D" title="Big Grin :D" data-shortname=":D" /></p><p>====================================================================</p><p>Screenie:<a href="http://prntscr.com/5epaj" target="_blank">http://prntscr.com/5epaj</a></p><p>Credis to Yabsoon from ******* Forums</p></blockquote><p></p>
[QUOTE="emo-nemo-321, post: 67414, member: 11618"] 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 ; [/CODE] Great now thats done so open up your Comp-newsarticle.tpl and replace [B][U]EVERYTHING[/U][/B] 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>[/PHP] There you go! :D ==================================================================== Screenie:[url]http://prntscr.com/5epaj[/url] Credis to Yabsoon from ******* Forums [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Releases
CMS Releases
[Release] News Comments For UberCMS!
Top