News selection

SaW

Member
Mar 3, 2018
101
15
Using the standard Habbo theme CMS and i want the selected news to be black in the news navigator, though i have no idea how to. Any help is very appreciated, thx.
You must be registered for see images attach
 

Zachariah

Active Member
Aug 26, 2017
177
78
PHP:
<?php
    {
    for ($i = 0; $i < 6; $i++)
        {
            $sectionName = "";
            $sectionCutoffMax = 0;
            $sectionCutoffMin = 0;
      
            switch ($i)
            {
                    case 0:
              
                            $sectionName = 'Today';
                            $sectionCutoffMax = time();
                            $sectionCutoffMin = time() - 86400;
                            break;
                      
                    case 1:
              
                            $sectionName = 'Yesterday';
                            $sectionCutoffMax = time() - 86400;
                            $sectionCutoffMin = time() - 172800;
                            break;
                      
                    case 2:
              
                            $sectionName = 'This week';
                            $sectionCutoffMax = time() - 172800;
                            $sectionCutoffMin = time() - 604800;
                            break;
                      
                    case 3:
              
                            $sectionName = 'Last week';
                            $sectionCutoffMax = time() - 604800;
                            $sectionCutoffMin = time() - 1209600;
                            break;
                      
                    case 4:
              
                            $sectionName = 'This month';
                            $sectionCutoffMax = time() - 1209600;
                            $sectionCutoffMin = time() - 2592000;
                            break;
                      
                    case 5:
              
                            $sectionName = 'Last month';
                            $sectionCutoffMax = time() - 2592000;
                            $sectionCutoffMin = time() - 5184000;
                            break;
            }
      
            $q = "SELECT * FROM cms_news WHERE published >= " . $sectionCutoffMin . " AND published <= " . $sectionCutoffMax .  " ORDER BY published DESC";
            $getArticles = mysql_query($q);
            if (mysql_num_rows($getArticles) > 0)
            {
                    echo '<br>';
                    echo '<h2>' . $sectionName . '</h2>';
              
                    while ($a = mysql_fetch_assoc($getArticles))
                    {
                        if($a['id'] == $_GET['id'])
                        {
                        echo '' . $a['title'] . '&nbsp;&raquo;<br>';
                        }
                        else
                        {
                        echo '<li><a href="/articles/' . $a['id'] . '">' . $a['title'] . '&nbsp;&raquo;</a></li>';
                        }
                    }
            }
        }
    }
?>
Try this pal, you'll want to put this under your " news " tab.
 

Object

?
Nov 10, 2017
415
328
PHP:
<?php
    {
    for ($i = 0; $i < 6; $i++)
        {
            $sectionName = "";
            $sectionCutoffMax = 0;
            $sectionCutoffMin = 0;
     
            switch ($i)
            {
                    case 0:
             
                            $sectionName = 'Today';
                            $sectionCutoffMax = time();
                            $sectionCutoffMin = time() - 86400;
                            break;
                     
                    case 1:
             
                            $sectionName = 'Yesterday';
                            $sectionCutoffMax = time() - 86400;
                            $sectionCutoffMin = time() - 172800;
                            break;
                     
                    case 2:
             
                            $sectionName = 'This week';
                            $sectionCutoffMax = time() - 172800;
                            $sectionCutoffMin = time() - 604800;
                            break;
                     
                    case 3:
             
                            $sectionName = 'Last week';
                            $sectionCutoffMax = time() - 604800;
                            $sectionCutoffMin = time() - 1209600;
                            break;
                     
                    case 4:
             
                            $sectionName = 'This month';
                            $sectionCutoffMax = time() - 1209600;
                            $sectionCutoffMin = time() - 2592000;
                            break;
                     
                    case 5:
             
                            $sectionName = 'Last month';
                            $sectionCutoffMax = time() - 2592000;
                            $sectionCutoffMin = time() - 5184000;
                            break;
            }
     
            $q = "SELECT * FROM cms_news WHERE published >= " . $sectionCutoffMin . " AND published <= " . $sectionCutoffMax .  " ORDER BY published DESC";
            $getArticles = mysql_query($q);
            if (mysql_num_rows($getArticles) > 0)
            {
                    echo '<br>';
                    echo '<h2>' . $sectionName . '</h2>';
             
                    while ($a = mysql_fetch_assoc($getArticles))
                    {
                        if($a['id'] == $_GET['id'])
                        {
                        echo '' . $a['title'] . '&nbsp;&raquo;<br>';
                        }
                        else
                        {
                        echo '<li><a href="/articles/' . $a['id'] . '">' . $a['title'] . '&nbsp;&raquo;</a></li>';
                        }
                    }
            }
        }
    }
?>
Try this pal, you'll want to put this under your " news " tab.
I think you mis understood him. From my understanding he want the active article to change from orange to black in the sidebar.

A way you could do it is to grab URL and match the id's together then change the matching one to black.
 

Synapse

PogChamp
Mar 3, 2012
164
59
Google using php to disable hrefs.

Basically as Rush said,



If you use this code but do an if statement for $_GET['id'] == $row['id']
 

Zachariah

Active Member
Aug 26, 2017
177
78
I think you mis understood him. From my understanding he want the active article to change from orange to black in the sidebar.

A way you could do it is to grab URL and match the id's together then change the matching one to black.

I was pretty sure he was talking about this, unless it's wrong and he needs to reword it around.
You must be registered for see images attach
 

Object

?
Nov 10, 2017
415
328
I was pretty sure he was talking about this, unless it's wrong and he needs to reword it around.
You must be registered for see images attach
I didnt read all of your code, thought you gave him the code to sort the articles into "categories", my bad! your code seems to do what he asked for aswell, even tho he it seems he fixed it
 

Users who are viewing this thread

Top