RevCMS help

shaheemz

Member
Feb 4, 2012
30
5
Hey coders,

I need some help with a few things (revcms):

Problem 1:

- I have a newslist.. my newsarticle opens when i click on the link in the newslist but the link disappears.
Who can help me with this?

Image:



===================================

Problem 2:

- Oke. My me-page is showing news article 1-5 but it looks like this when i only have 2 news articles:


1. test27-05-2012
2. test27-05-2012
3. newsTitle-3newsDate-3
4. newsTitle-4newsDate-4
5. newsTitle-5newsDate-5

Can someone fix this for me so it will say "No news" instead of just newsTitle or newsDate?


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, 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']));
         
                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);
    }
 
}
 
?>
 

xpixiex

New Member
Apr 29, 2012
13
1
theme ? which one...
ex. Mango, Priv, Habbo etc.



Problem 1: I think it's normal, more like because when you go into an article it's silly if you link yourself in the same page.. Maybe you could customize it, code it yourself than using {newslist} and make the current new that is open, "Welkom op Tubbo hotel!", class="selected" than using href..

If you understand me then good... If not please don't flame I'm not a prof ;)

Problem 2: If you are using Mango skin, or what ever skin, just erase some parts of the me.php, just for example in Mango theme..

PHP:
<div id="main_right">
<div id="top_stories">
<div id="top-story">
<div id="top-snippet"></div>
</div>
<div id="top-headlines-holder">
<div class="subnews_1"><a href="index.php?url=news&id={newsID-1}">{newsTitle-1} &raquo;</a>
<div class="sub-news-date">{newsDate-1}</div>
</div>
<div class="subnews_0"><a href="index.php?url=news&id={newsID-2}">{newsTitle-2} &raquo;</a>
<div class="sub-news-date">{newsDate-2}</div>
</div>
<div class="subnews_1"><a href="index.php?url=news&id={newsID-3}">{newsTitle-3} &raquo;</a>
<div class="sub-news-date">{newsDate-3}</div>
</div>
<div class="subnews_0"><a href="index.php?url=news&id={newsID-4}">{newsTitle-4} &raquo;</a>
<div class="sub-news-date">{newsDate-4}</div>
</div>
<div class="subnews_1"><a href="index.php?url=news&id={newsID-1}">{newsTitle-5} &raquo;</a>
<div class="sub-news-date">{newsDate-5}</div>
</div>
<div style="text-align:right; margin:3px;"><a href="news">Read more &raquo;</a></div>
</div>
</div>
<br/>&nbsp;<br/>
</script>

erase some like if you only want 2 articles to be displayed erase..
PHP:
<div class="subnews_1"><a href="index.php?url=news&id={newsID-3}">{newsTitle-3} &raquo;</a>
<div class="sub-news-date">{newsDate-3}</div>
</div>
<div class="subnews_0"><a href="index.php?url=news&id={newsID-4}">{newsTitle-4} &raquo;</a>
<div class="sub-news-date">{newsDate-4}</div>
</div>
<div class="subnews_1"><a href="index.php?url=news&id={newsID-1}">{newsTitle-5} &raquo;</a>
<div class="sub-news-date">{newsDate-5}</div>
</div>


Hope I helped :D
 

Gajeel

Well-Known Member
Oct 4, 2011
2,411
413
As said, if you only want 2 news article to be rolled or displayed on your homepage, you could cut the codes, make sure you do not left any excess codes or cut extra ones. But if you want 5, you should fulfill 5 articles so they show up on your homepage.

And it disappears because it is the current news being viewed, if you switch to another news it re-appears. ;)
 

Users who are viewing this thread

Top