News MySQLi Help

Status
Not open for further replies.

Blasteh

Lord Farquaad
Apr 3, 2013
1,151
513
Hi,
So I'm using a CMS that is coded in MySQLi (knock-off of RevCMS) and I've been having some issues.

The news isn't reading correctly for some reason, as you can see:
You must be registered for see images attach


But, it is in the database table (cms_news), and reads right, except for the URL which I'm guessing is due to web.config.
You must be registered for see images attach


Fixed the news preview, just need them to show on /me

The class for news/forms:
PHP:
        final public function getPageNews()
            {
                global $template, $engine;
          
                    if(!isset($_GET['id']) || !is_numeric($_GET['id']))
                    {
                        $_GET['id'] = 1;
                    }
                        $result = dbquery("SELECT title, id FROM cms_news WHERE id != '" . $engine->secure($_GET['id']) . "' ORDER BY id DESC");
                  
                        while($news1 = mysqli_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, shortstory, author, published FROM cms_news WHERE id = '" . $engine->secure($_GET['id']) . "' LIMIT 1");
                        $author = $engine->fetch_assoc("SELECT look FROM users WHERE username = ".$news['author']." LIMIT 1");
                        $template->setParams('newsTitle', $news['title']);
                        $template->setParams('newsContent', $news['longstory']);
                        $template->setParams('newsAuthor', $news['author']);
                        $template->setParams('newsDate', date("M d, Y", $news['published']));
                        $template->setParams('newsPreview', $news['shortstory']);
                        $template->setParams('authorLook', $author['look']);
              
                        unset($result);
                        unset($news1);
                        unset($news);
            }
    
        final public function getPageHome()
        {
            global $template, $engine;
            $a = 1;
            $data = dbquery("SELECT title, id, published, shortstory, image FROM cms_news ORDER BY id DESC LIMIT 5");
                    
            while($news = mysqli_fetch_array($data, MYSQLI_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);
        }
        
    }
 
Last edited:

Blasteh

Lord Farquaad
Apr 3, 2013
1,151
513
From experience I can’t imagine a lot of help, maybe a few Google seasions? After all it is years old.
It’s not RevCMS, as stated. The other classes are recoded, paths are not the same, etc. I can’t google it as the CMS was coded for Hablix. The creator is in University and our time zones are the exact opposite.

So..
{newstitle} etc isnt doing it's job?
Sadly, no.
 

Detox

Member
Jul 24, 2010
365
24
Try doing research on here & Because just by slighting reading the code it's looks like it might have something to do with fetch_array and fetch_assoc but just like looking at your images It able to pull it on news.php
 

Blasteh

Lord Farquaad
Apr 3, 2013
1,151
513
Try doing research on here & Because just by slighting reading the code it's looks like it might have something to do with fetch_array and fetch_assoc but just like looking at your images It able to pull it on news.php
I took a peak, played with the code a bit - no luck.

I think it’s to do with one of the classes. Try class template?
Everything that is supposed to be in it, is in the class.
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,128
2,456
I might be able to help you, but I don't fully understand what issues you have, and I don't think I see corresponding code either.
 

Blasteh

Lord Farquaad
Apr 3, 2013
1,151
513
With the help of @JynX, I was able to solve the issue.

If anyone else is having this problem, Jake (Jynx) recoded my getPageHome() function, also, navigate to your class.core.php and make sure the following code is correct:
PHP:
                        case "me":
                            $template->form->getPageHome();
                            break;

Mine, the code was:
PHP:
                        case "me":
                            $template->form->getPageNews();
                            break;
 

Pinkman

Posting Freak
Jul 27, 2016
814
193
With the help of @JynX, I was able to solve the issue.

If anyone else is having this problem, Jake (Jynx) recoded my getPageHome() function, also, navigate to your class.core.php and make sure the following code is correct:
PHP:
                        case "me":
                            $template->form->getPageHome();
                            break;

Mine, the code was:
PHP:
                        case "me":
                            $template->form->getPageNews();
                            break;
Did say it was to do with the classes :D Sorry just that you weren't responding to me ;(
 
Status
Not open for further replies.

Users who are viewing this thread

Top