RevCMS News not working..

MadMonsterMan

Member
Mar 25, 2016
202
13
DAMNIT2.png
DAMNIT.png

Yes theres news articles in cms_news...
Ive had this prob forever and its so annoying.
Anyone know how to fix?
& its like every revcms habbo theme i downloadit does this.
but if i download a simple bootstrap Edit the news works perfect?
@Sledmore @JayCustom @_J_
 
Last edited:

JayC

Well-Known Member
Aug 8, 2013
5,505
1,401
Go to your TPL folder and open the class.forms.tpl and replace with this
Code:
<?php

namespace Revolution;
if(!defined('IN_INDEX')) { die('Sorry, you cannot access this file.'); }
class forms implements iForms
{

    public $error;

    final public function setData()
    {
        global $engine;
        foreach($_POST as $key => $value)
        {
            if($value != null)
            {
                $this->$key = $engine->secure($value);
            }
            else
            {
                $this->error = 'Please fill in all fields';
                return;
            }
        }
   
    }
   
    final public function unsetData()
    {
        global $template;
        foreach($this as $key => $value)
        {
            unset($this->$key);   
        }   
    }
   
    final public function writeData($key)
    {
        global $template;
        echo $this->$key;
    }
   
    final public function outputError()
    {
        global $template;
        if(isset($this->error))
        {
            echo "<div id='message'> " . $this->error . " </div>";
        }
    }
   
    /* Manage different pages */
   
    final public function getPageNews()
    {
        global $template, $engine;
       
            if(!isset($_GET['id']) || !is_numeric($_GET['id']))
            {
                $_GET['id'] = 1;
            }
                $result = mysql_query("SELECT title, id FROM cms_news WHERE id != '" . $engine->secure($_GET['id']) . "' ORDER BY id DESC");
               
                while($news1 = mysql_fetch_array($result))
                {
                    $template->setParams('newsList', '&laquo; <a href="index.php?url=news&id='.$news1["id"].'">' . $news1['title'] . '</a><br/>');
                }
               
                $news = $engine->fetch_assoc("SELECT title, shortstory, longstory, author, published FROM cms_news WHERE id = '" . $engine->secure($_GET['id']) . "' LIMIT 1");
                $template->setParams('newsTitle', $news['title']);
                $template->setParams('newsContent', $news['longstory']);
                $template->setParams('newsAuthor', $news['author']);
                $template->setParams('newsDate', date("d-m-y", $news['published']));
                $template->setParams('newsPreview', $news['shortstory']);
           
                unset($result);
                unset($news1);
                unset($news);
    }
   
    final public function getPageHome()
    {
        global $template, $engine;
        $a = 1;
        $data = mysql_query("SELECT title, id, published, shortstory, image FROM cms_news ORDER BY id DESC LIMIT 5");
               
        while($news = mysql_fetch_array($data, MYSQL_ASSOC))
          {
            $template->setParams('newsTitle-' . $a, $news['title']);
            $template->setParams('newsID-' . $a, $news['id']);
            $template->setParams('newsDate-' . $a, date("d-m-y", $news['published']));
            $template->setParams('newsCaption-' . $a, $news['shortstory']);
            $template->setParams('newsIMG-' . $a, $news['image']);
            $a++;
        }
       
        unset($news);
        unset($data);
    }
   
}

?>
 

MadMonsterMan

Member
Mar 25, 2016
202
13
Go to your TPL folder and open the class.forms.tpl and replace with this
Code:
<?php

namespace Revolution;
if(!defined('IN_INDEX')) { die('Sorry, you cannot access this file.'); }
class forms implements iForms
{

    public $error;

    final public function setData()
    {
        global $engine;
        foreach($_POST as $key => $value)
        {
            if($value != null)
            {
                $this->$key = $engine->secure($value);
            }
            else
            {
                $this->error = 'Please fill in all fields';
                return;
            }
        }
  
    }
  
    final public function unsetData()
    {
        global $template;
        foreach($this as $key => $value)
        {
            unset($this->$key);  
        }  
    }
  
    final public function writeData($key)
    {
        global $template;
        echo $this->$key;
    }
  
    final public function outputError()
    {
        global $template;
        if(isset($this->error))
        {
            echo "<div id='message'> " . $this->error . " </div>";
        }
    }
  
    /* Manage different pages */
  
    final public function getPageNews()
    {
        global $template, $engine;
      
            if(!isset($_GET['id']) || !is_numeric($_GET['id']))
            {
                $_GET['id'] = 1;
            }
                $result = mysql_query("SELECT title, id FROM cms_news WHERE id != '" . $engine->secure($_GET['id']) . "' ORDER BY id DESC");
              
                while($news1 = mysql_fetch_array($result))
                {
                    $template->setParams('newsList', '&laquo; <a href="index.php?url=news&id='.$news1["id"].'">' . $news1['title'] . '</a><br/>');
                }
              
                $news = $engine->fetch_assoc("SELECT title, shortstory, longstory, author, published FROM cms_news WHERE id = '" . $engine->secure($_GET['id']) . "' LIMIT 1");
                $template->setParams('newsTitle', $news['title']);
                $template->setParams('newsContent', $news['longstory']);
                $template->setParams('newsAuthor', $news['author']);
                $template->setParams('newsDate', date("d-m-y", $news['published']));
                $template->setParams('newsPreview', $news['shortstory']);
          
                unset($result);
                unset($news1);
                unset($news);
    }
  
    final public function getPageHome()
    {
        global $template, $engine;
        $a = 1;
        $data = mysql_query("SELECT title, id, published, shortstory, image FROM cms_news ORDER BY id DESC LIMIT 5");
              
        while($news = mysql_fetch_array($data, MYSQL_ASSOC))
          {
            $template->setParams('newsTitle-' . $a, $news['title']);
            $template->setParams('newsID-' . $a, $news['id']);
            $template->setParams('newsDate-' . $a, date("d-m-y", $news['published']));
            $template->setParams('newsCaption-' . $a, $news['shortstory']);
            $template->setParams('newsIMG-' . $a, $news['image']);
            $a++;
        }
      
        unset($news);
        unset($data);
    }
  
}

?>
I did and still not working...? Anything else that might fix.. Its been going on 3 days now.
 

Ghost

Legacy, it's all anyone leaves behind.
Jun 8, 2012
1,640
503
Post your cms_news table or site_news table from your Database here. Because if you look at the fact that each coloum contains a different name, and some databases tend to have it different thats probably your problem.
 

MadMonsterMan

Member
Mar 25, 2016
202
13
Code:
-- phpMyAdmin SQL Dump
-- version 4.4.15.5
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: May 18, 2016 at 01:10 AM
-- Server version: 5.6.28-log
-- PHP Version: 5.3.28

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `pluz?1`
--

-- --------------------------------------------------------

--
-- Table structure for table `cms_news`
--

CREATE TABLE IF NOT EXISTS `cms_news` (
  `id` int(11) NOT NULL,
  `title` varchar(100) NOT NULL,
  `image` varchar(100) NOT NULL DEFAULT '0',
  `shortstory` text NOT NULL,
  `longstory` text,
  `author` varchar(25) NOT NULL,
  `date` varchar(11) NOT NULL DEFAULT '0',
  `type` varchar(100) NOT NULL DEFAULT '1',
  `roomid` varchar(100) NOT NULL DEFAULT '1',
  `updated` enum('0','1') NOT NULL DEFAULT '0'
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

--
-- Dumping data for table `cms_news`
--

INSERT INTO `cms_news` (`id`, `title`, `image`, `shortstory`, `longstory`, `author`, `date`, `type`, `roomid`, `updated`) VALUES
(2, 'Updates...', 'lpromo_gen_bday_4.png', 'As you can see..', 'HabSocial has made some changes around the layout part of HabSocial. We will continue to make & add more fun things to the website.', 'Tom', '0', '1', '1', '1'),
(3, 'Welcome to HabSocial!', 'webpromo_permeffects.png', 'Let''s get moving..', 'Welcome new users, we are very happy that you chose to play. We have a lot of new updates coming up and already have happen.\r\nNew commands:\r\n:cut ( cuts users head off)\r\n:heal (to heal all wounds)\r\n:hit ( hit another user)\r\n:hug ( hug another user)\r\nUpcoming commands:\r\n:slapAss ( slap another users ass)\r\n:buy & sell rooms ( already on habsocial but needs fixing)\r\nNew pets \r\n2016 HC furniture\r\nSmooth dragons\r\nMuch more!! Stay tuned on HabSocial...', '', '0', '1', '1', '0'),
(4, 'Whats your thoughts?', 'bouwteam_topstory.png', 'We want to know your opinion!', 'HabSocial wants to know your thoughts on how the new layout looks? You can email:<b>[email protected]<b> or you can submit a message here: <a href="http://habsocial.com/thoughts.php">Click Here!</a>\r\n', '', '0/1/13', '1', '1', '0');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `cms_news`
--
ALTER TABLE `cms_news`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `cms_news`
--
ALTER TABLE `cms_news`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;
DELIMITER $$
--
-- Events
--
CREATE DEFINER=`root`@`localhost` EVENT `daily_pet_respect_points` ON SCHEDULE EVERY 24 HOUR STARTS '2015-02-10 00:00:00' ON COMPLETION NOT PRESERVE ENABLE DO update users_stats set daily_pet_respect_points = 5 where daily_pet_respect_points = 0$$

CREATE DEFINER=`root`@`localhost` EVENT `daily_respect_points` ON SCHEDULE EVERY 24 HOUR STARTS '2015-01-12 21:39:07' ON COMPLETION NOT PRESERVE ENABLE DO update users_stats set daily_respect_points = 5 where daily_respect_points = 0$$

CREATE DEFINER=`root`@`localhost` EVENT `respect_fixen_MoIsKoel` ON SCHEDULE EVERY 24 HOUR STARTS '2012-01-01 23:59:00' ON COMPLETION NOT PRESERVE ENABLE DO UPDATE user_stats
SET
DailyRespectPoints = '20',
DailyPetRespectPoints = '20'$$

DELIMITER ;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
 

MadMonsterMan

Member
Mar 25, 2016
202
13
post the code for your news on the page :) Just to verify that its grabbing the variables correctly.
Code:
<?php
if(isset($_GET['id']))
{
    $id = mysql_real_escape_string($_GET['id']);
    $query = mysql_query( "SELECT * FROM `cms_news` WHERE id = '{$id}'" );
    $array = mysql_fetch_array($query);
   
    if ($array == null)
    {
        $getMax = mysql_fetch_array(mysql_query("SELECT MAX(id) FROM cms_news LIMIT 1"));
        header("Location: ".$_CONFIG['hotel']['url']."/index.php?url=news&id=". $getMax['MAX(id)'] ."");
        exit();
    }
}
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8">
        <title>{hotelName} - News</title>
        <link rel="shortcut icon" href="{url}/favicon.ico?<?php echo time() ?>" type="image/x-icon"/>
        <link rel="stylesheet" href="{url}/app/tpl/skins/Habbo/styles/common.css?<?php echo time() ?>" type="text/css">
        <script type="text/javascript" src="{url}/app/tpl/skins/Habbo/js/libs2.js?<?php echo time() ?>"></script>
        <script type="text/javascript" src="{url}/app/tpl/skins/Habbo/js/visual.js?<?php echo time() ?>"></script>
        <script type="text/javascript" src="{url}/app/tpl/skins/Habbo/js/libs.js?<?php echo time() ?>"></script>
        <script type="text/javascript" src="{url}/app/tpl/skins/Habbo/js/common.js?<?php echo time() ?>"></script>
        <script type="text/javascript" src="{url}/app/tpl/skins/Habbo/js/fullcontent.js?<?php echo time() ?>"></script>
       
        <script type="text/javascript">
            document.habboLoggedIn = true;
            var habboName = "{username}";
            var habboId = {userid};
            var habboReqPath = "";
            var habboStaticFilePath = "{url}/app/tpl/skins/Habbo";
            var habboImagerUrl = "http://www.habbo.com.tr/habbo-imaging/";
            var habboPartner = "";
            var habboDefaultClientPopupUrl = "{url}/client";
            window.name = "habboMain";
            if (typeof HabboClient != "undefined") {
                HabboClient.windowName = "eac955c8dbc88172421193892a3e98fc7402021a";
                HabboClient.maximizeWindow = true;
            }
        </script>
       
        <!--[if IE 8]>
            <link rel="stylesheet" href="{url}/app/tpl/skins/Habbo/styles/ie8.css" type="text/css">
        <![endif]-->
        <!--[if lt IE 8]>
            <link rel="stylesheet" href="{url}/app/tpl/skins/Habbo/styles/ie.css" type="text/css" />
        <![endif]-->
        <!--[if lt IE 7]>
            <link rel="stylesheet" href="{url}/app/tpl/skins/Habbo/styles/ie6.css" type="text/css" />
            <script type="text/javascript" src="{url}/app/tpl/skins/Habbo/js/pngfix.js"></script>
            <script type="text/javascript">
                try { document.execCommand('BackgroundImageCache', false, true); } catch(e) {}
            </script>
            <style type="text/css">
                body { behavior: url({url}/app/tpl/skins/Habbo/js/csshover.htc); }
            </style>
        <![endif]-->
    </head>
   
    <body id="news">
   
        <div id="overlay"></div>
        <div id="header-container">
            <div id="header" class="clearfix">
                <h1><a href="{url}/"></a></h1>
                <div id="subnavi">
                    <div id="subnavi-user">
                    <div style="margin-top:7px;font-size:10px">
                        <?php include"randomFacts.php" ?>
                     </div>
                    </div>
                    <div id="subnavi-search">
                        <div id="subnavi-search-upper">
                            <ul id="subnavi-search-links">
                              <li><a href="{url}/logout" style="color:#000;font-size:10px;">Sign Out</a>
                            </ul>
                        </div>
                    </div>
                    <div id="to-hotel">
                                     <a href="{url}/client" class="new-button green-button" target="05efbade773135677a28f2b338c5bdf93774237c" onclick="HabboClient.openOrFocus(this); return false;"><b>Enter {hotelName} Hotel</b><i></i></a>
                 <?php if($_SESSION['user']['rank'] >= 4) { echo '<a href="{url}/manage/login" class="new-button red-button" action="_new" style="left: -5px;"><b>Housekeeping</b><i></i></a>'; } ?>
                 </div>
                </div>
                <ul id="navi">
                    <li class="metab"><a href="{url}/me"><?php echo ($_SESSION['user']['username']); ?></a><span></span></li>
                    <li class="selected"><strong>Community</strong><span></span></li>
                    <li class="viptab"><a href="{url}/shop">Shop</a><span></span></li>
                    <li class="viptab5"><a href="http://babboboards.com" target="_blank">Forum</a><span></span></li>
                </ul>
                <div id="habbos-online"><div class="rounded"><span>{online} members online</span></div></div>
            </div>
        </div>
        <div id="content-container">
            <div id="navi2-container" class="pngbg">
                <div id="navi2" class="pngbg clearfix">
                    <ul>
                        <li class=""><a href="{url}/community">Community</a></li>
                        <li class="selected">News</li>
                        <li class=" last"><a href="{url}/community/staff">Staff</a></li>
                    </ul>
                </div>
            </div>
            <div id="container">
                <div id="content" style="position: relative" class="clearfix">
                    <div id="column1" class="column">
                        <div class="habblet-container ">       
                            <div class="cbb clearfix default ">
                                <h2 class="title">News</h2>
                                <div id="article-archive">
                                    <ul>
                                        {newsList}
                                    </ul>
                                </div>
                            </div>
                        </div>
                        <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
                    </div>
                    <div id="column2" class="column">
                        <div class="habblet-container ">       
                            <div class="cbb clearfix notitle ">
                                <div id="article-wrapper">
                                    <h2>{newsTitle}</h2>
                                    <div class="article-meta">Posted {newsDate}</div>
                                    <p class="summary">{newsPreview}</p>
                                    <div class="article-body">
                                        {newsContent}
                                        <br><br>
                                        <p><font face="Verdana" size="1"><b>- {newsAuthor}</b></p>
                                        <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-2729').each(function(a) {
                                                    a.replace(a.innerHTML);
                                                });
                                            });
                                        </script>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
                    </div>
                </div>
            </div>
        </div>
        <script type="text/javascript">if (!$(document.body).hasClassName('process-template')) { Rounder.init(); }</script>
        <script type="text/javascript">
            HabboView.run();
        </script>

        <!--[if lt IE 7]>
            <script type="text/javascript">
                Pngfix.doPngImageFix();
            </script>
        <![endif]-->
       
        <div id="footer" >
        </div>
   
    </body>
</html>
 
It's trying to grab published^ and published does not exist.
Hmm, so what shall I do?
 

Ghost

Legacy, it's all anyone leaves behind.
Jun 8, 2012
1,640
503
PHP:
<?php

namespace Revolution;
if(!defined('IN_INDEX')) { die('Sorry, you cannot access this file.'); }
class forms implements iForms
{

    public $error;

    final public function setData()
    {
        global $engine;
        foreach($_POST as $key => $value)
        {
            if($value != null)
            {
                $this->$key = $engine->secure($value);
            }
            else
            {
                $this->error = 'Please fill in all fields';
                return;
            }
        }

    }

    final public function unsetData()
    {
        global $template;
        foreach($this as $key => $value)
        {
            unset($this->$key);
        }
    }

    final public function writeData($key)
    {
        global $template;
        echo $this->$key;
    }

    final public function outputError()
    {
        global $template;
        if(isset($this->error))
        {
            echo "<div id='message'> " . $this->error . " </div>";
        }
    }

    /* Manage different pages */

    final public function getPageNews()
    {
        global $template, $engine;
    
            if(!isset($_GET['id']) || !is_numeric($_GET['id']))
            {
                $_GET['id'] = 1;
            }
                $result = mysql_query("SELECT title, id FROM cms_news WHERE id != '" . $engine->secure($_GET['id']) . "' ORDER BY id DESC");
            
                while($news1 = mysql_fetch_array($result))
                {
                    $template->setParams('newsList', '&laquo; <a href="index.php?url=news&id='.$news1["id"].'">' . $news1['title'] . '</a><br/>');
                }
            
                $news = $engine->fetch_assoc("SELECT title, shortstory, longstory, author, date FROM cms_news WHERE id = '" . $engine->secure($_GET['id']) . "' LIMIT 1");
                $template->setParams('newsTitle', $news['title']);
                $template->setParams('newsContent', $news['longstory']);
                $template->setParams('newsAuthor', $news['author']);
                $template->setParams('newsDate', date("d-m-y", $news['date']));
                $template->setParams('newsPreview', $news['shortstory']);
        
                unset($result);
                unset($news1);
                unset($news);
    }

    final public function getPageHome()
    {
        global $template, $engine;
        $a = 1;
        $data = mysql_query("SELECT title, id, date, shortstory, image FROM cms_news ORDER BY id DESC LIMIT 5");
            
        while($news = mysql_fetch_array($data, MYSQL_ASSOC))
          {
            $template->setParams('newsTitle-' . $a, $news['title']);
            $template->setParams('newsID-' . $a, $news['id']);
            $template->setParams('newsDate-' . $a, date("d-m-y", $news['date']));
            $template->setParams('newsCaption-' . $a, $news['shortstory']);
            $template->setParams('newsIMG-' . $a, $news['image']);
            $a++;
        }
    
        unset($news);
        unset($data);
    }

}

?>

"Go to your TPL folder and open the class.forms.tpl and replace with this"


Published = date (timestamp)
date = published (timestamp)
 

MadMonsterMan

Member
Mar 25, 2016
202
13
PHP:
<?php

namespace Revolution;
if(!defined('IN_INDEX')) { die('Sorry, you cannot access this file.'); }
class forms implements iForms
{

    public $error;

    final public function setData()
    {
        global $engine;
        foreach($_POST as $key => $value)
        {
            if($value != null)
            {
                $this->$key = $engine->secure($value);
            }
            else
            {
                $this->error = 'Please fill in all fields';
                return;
            }
        }

    }

    final public function unsetData()
    {
        global $template;
        foreach($this as $key => $value)
        {
            unset($this->$key);
        }
    }

    final public function writeData($key)
    {
        global $template;
        echo $this->$key;
    }

    final public function outputError()
    {
        global $template;
        if(isset($this->error))
        {
            echo "<div id='message'> " . $this->error . " </div>";
        }
    }

    /* Manage different pages */

    final public function getPageNews()
    {
        global $template, $engine;
   
            if(!isset($_GET['id']) || !is_numeric($_GET['id']))
            {
                $_GET['id'] = 1;
            }
                $result = mysql_query("SELECT title, id FROM cms_news WHERE id != '" . $engine->secure($_GET['id']) . "' ORDER BY id DESC");
           
                while($news1 = mysql_fetch_array($result))
                {
                    $template->setParams('newsList', '&laquo; <a href="index.php?url=news&id='.$news1["id"].'">' . $news1['title'] . '</a><br/>');
                }
           
                $news = $engine->fetch_assoc("SELECT title, shortstory, longstory, author, date FROM cms_news WHERE id = '" . $engine->secure($_GET['id']) . "' LIMIT 1");
                $template->setParams('newsTitle', $news['title']);
                $template->setParams('newsContent', $news['longstory']);
                $template->setParams('newsAuthor', $news['author']);
                $template->setParams('newsDate', date("d-m-y", $news['date']));
                $template->setParams('newsPreview', $news['shortstory']);
       
                unset($result);
                unset($news1);
                unset($news);
    }

    final public function getPageHome()
    {
        global $template, $engine;
        $a = 1;
        $data = mysql_query("SELECT title, id, date, shortstory, image FROM cms_news ORDER BY id DESC LIMIT 5");
           
        while($news = mysql_fetch_array($data, MYSQL_ASSOC))
          {
            $template->setParams('newsTitle-' . $a, $news['title']);
            $template->setParams('newsID-' . $a, $news['id']);
            $template->setParams('newsDate-' . $a, date("d-m-y", $news['date']));
            $template->setParams('newsCaption-' . $a, $news['shortstory']);
            $template->setParams('newsIMG-' . $a, $news['image']);
            $a++;
        }
   
        unset($news);
        unset($data);
    }

}

?>

"Go to your TPL folder and open the class.forms.tpl and replace with this"


Published = date (timestamp)
date = published (timestamp)
kind of confusing.
 
kind of confusing.
Published = date (timestamp)
date = published (timestamp)
Where do I replace?
 

Users who are viewing this thread

Top