[pre-release] dev cms

Page 2 of 5 FirstFirst 12345 LastLast
Results 16 to 30 of 63
  1. #16
    Enthusiast Cody Allan is offline
    MemberRank
    Nov 2012 Join Date
    46Posts

    Re: [pre-release] dev cms

    lol so thats where my co-owner found that index page

  2. #17
    Enthusiast Didie Thiago is offline
    MemberRank
    Jun 2013 Join Date
    AustraliaLocation
    45Posts

    Re: [pre-release] dev cms

    no your index is wabbo index someone released it along with the register page :P

  3. #18
    Member TR10G33K is offline
    MemberRank
    Jan 2013 Join Date
    NetherlandsLocation
    71Posts

    Re: [pre-release] dev cms

    PHP Code:
      if (isset($_GET['p'])) 
            { 
                if (
    $_GET['p'] == 'me'
                { 
                    
    $colour[0] = ' white'
                } 
                else if (
    $_GET['p'] == 'home'
                { 
                    
    $colour[1] = ' class="white"'
                } 
                else if (
    $_GET['p'] == 'account'
                { 
                    
    $colour[2] = ' class="white"'
                } 
                else if (
    $_GET['p'] == 'news'
                { 
                    
    $colour[3] = ' class="white"'
                } 
                else if (
    $_GET['p'] == 'staff'
                { 
                    
    $colour[4] = ' class="white"'
                } 
                else if (
    $_GET['p'] == 'shop'
                { 
                    
    $colour[5] = ' class="white"'
                } 
                else 
                { 
                    
    $colour NULL
                } 
            } 
    Start using switch statements man...

  4. #19
    Developer Quackster is offline
    DeveloperRank
    Dec 2010 Join Date
    AustraliaLocation
    3,479Posts

    Re: [pre-release] dev cms

    Quote Originally Posted by TR10G33K View Post
    PHP Code:
      if (isset($_GET['p'])) 
            { 
                if (
    $_GET['p'] == 'me'
                { 
                    
    $colour[0] = ' white'
                } 
                else if (
    $_GET['p'] == 'home'
                { 
                    
    $colour[1] = ' class="white"'
                } 
                else if (
    $_GET['p'] == 'account'
                { 
                    
    $colour[2] = ' class="white"'
                } 
                else if (
    $_GET['p'] == 'news'
                { 
                    
    $colour[3] = ' class="white"'
                } 
                else if (
    $_GET['p'] == 'staff'
                { 
                    
    $colour[4] = ' class="white"'
                } 
                else if (
    $_GET['p'] == 'shop'
                { 
                    
    $colour[5] = ' class="white"'
                } 
                else 
                { 
                    
    $colour NULL
                } 
            } 
    Start using switch statements man...
    They are if statements.

  5. #20
    Member TR10G33K is offline
    MemberRank
    Jan 2013 Join Date
    NetherlandsLocation
    71Posts

    Re: [pre-release] dev cms

    Quote Originally Posted by Quackster View Post
    They are if statements.
    You didn't read my comment, I said that he should start using Switch statements for the code i showed...

  6. #21
    Old Habbo Developer AresCJ is offline
    MemberRank
    Jan 2009 Join Date
    USALocation
    1,183Posts

    Re: [pre-release] dev cms

    Dan, I'm surprised you even came back! Hit me up.

  7. #22
    Developer Quackster is offline
    DeveloperRank
    Dec 2010 Join Date
    AustraliaLocation
    3,479Posts

    Re: [pre-release] dev cms

    Quote Originally Posted by TR10G33K View Post
    You didn't read my comment, I said that he should start using Switch statements for the code i showed...
    My mistake, I read that as stop.

  8. #23
    I don't even know azaidi is offline
    MemberRank
    Apr 2010 Join Date
    the NetherlandsLocation
    2,065Posts

    Re: [pre-release] dev cms

    Quote Originally Posted by TR10G33K View Post
    PHP Code:
      if (isset($_GET['p'])) 
            { 
                if (
    $_GET['p'] == 'me'
                { 
                    
    $colour[0] = ' white'
                } 
                else if (
    $_GET['p'] == 'home'
                { 
                    
    $colour[1] = ' class="white"'
                } 
                else if (
    $_GET['p'] == 'account'
                { 
                    
    $colour[2] = ' class="white"'
                } 
                else if (
    $_GET['p'] == 'news'
                { 
                    
    $colour[3] = ' class="white"'
                } 
                else if (
    $_GET['p'] == 'staff'
                { 
                    
    $colour[4] = ' class="white"'
                } 
                else if (
    $_GET['p'] == 'shop'
                { 
                    
    $colour[5] = ' class="white"'
                } 
                else 
                { 
                    
    $colour NULL
                } 
            } 
    Start using switch statements man...
    Array or something dynamic would be better, I don't like having 20 ifs/switches for different pages

  9. #24
    Account Upgraded | Title Enabled! Predict is offline
    MemberRank
    Aug 2008 Join Date
    760Posts

    Re: [pre-release] dev cms

    Quote Originally Posted by azaidi View Post
    Array or something dynamic would be better, I don't like having 20 ifs/switches for different pages
    To solve this method I would put the pages names into a table and fetch each field from a loop to make it dynamic and with doing so I would fetch each field with $_GET to see if the page is active or not with doing so will add a class. Something like that anyway

  10. #25
    Account Upgraded | Title Enabled! Predict is offline
    MemberRank
    Aug 2008 Join Date
    760Posts

    Re: [pre-release] dev cms

    Quote Originally Posted by Predict View Post
    To solve this method I would put the pages names into a table and fetch each field from a loop to make it dynamic and with doing so I would fetch each field with $_GET to see if the page is active or not with doing so will add a class. Something like that anyway
    Here is for whoever wanted the header dynamic, there are some flaws making it dynamic, mainly a .CSS class and naming the first page appropriately, but anyway.

    PHP Code:
        public static function header ()
        {
            GLOBAL 
    $config$db;
            
    $query 'SELECT page_name FROM www_header ORDER BY ID LIMIT 10'// LIMIT IS 10 SO IT DONT RUIN STYLE
            
    $statement $db->prepare($query);
            if(
    $statement)
            {
                
    $statement->execute();
                
    $statement->bind_result($page_name);
                while(
    $statement->fetch())
                {
                    if (
    strtolower($page_name) == $_GET['p'])
                    {
                        
    $result .= '<li><a href="'.$config['www']['url'].'/?p='.strtolower($page_name).'" target="_self" class="white">'.$page_name.'</a></li>';
                    }
                    else
                    {
                        
    $result .= '<li><a href="'.$config['www']['url'].'/?p='.strtolower($page_name).'" target="_self">'.$page_name.'</a></li>';
                    }
                }
                
    $statement->close();
            }
            
            return (
    '<div id="container-header">
                <div id="backdrop"></div>
                <div class="container">
                    <div id="container-navigation">
                        <a href="'
    .$config['www']['url'].'/?p=me" target="_self" id="logo"></a>
                        <ul class="navigation">
                            '
    .$result.'
                            <li><a href="'
    .$config['www']['url'].'/?p=logout" target="_self" class="last">Logout</a></li>
                        </ul>
                        <ul class="navigation">
                            <li><a href="'
    .$config['www']['url'].'/?p=client" target="_self" class="first green">Enter '.$config['www']['name'].' Hotel</a></li>
                            <li><a href="'
    .$config['www']['url'].'/?p=users" target="_self" class="last white">0 &nbsp; users online</a></li>
                        </ul>
                    </div>
                </div>
            </div>'
    );
                
        } 
    Code:
    -- phpMyAdmin SQL Dump
    -- version 3.5.5
    -- http://www.phpmyadmin.net
    --
    -- Host: localhost
    -- Generation Time: Oct 30, 2013 at 12:59 PM
    -- Server version: 5.1.69
    -- PHP Version: 5.3.17
    
    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 utf8 */;
    
    --
    -- Database: `barneyx1_x1`
    --
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `www_header`
    --
    
    CREATE TABLE IF NOT EXISTS `www_header` (
      `ID` int(11) NOT NULL AUTO_INCREMENT,
      `page_name` text NOT NULL,
      PRIMARY KEY (`ID`),
      UNIQUE KEY `ID_2` (`ID`),
      KEY `ID` (`ID`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ;
    
    --
    -- Dumping data for table `www_header`
    --
    
    INSERT INTO `www_header` (`ID`, `page_name`) VALUES
    (1, 'Me'),
    (2, 'Home'),
    (3, 'Account'),
    (4, 'News'),
    (5, 'Staff'),
    (6, 'Shop');
    
    /*!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 */;

  11. #26
    Account Upgraded | Title Enabled! Predict is offline
    MemberRank
    Aug 2008 Join Date
    760Posts

    Re: [pre-release] dev cms

    I've done two more functions to be added to the html class, two being generic for me.php (personal) and one being dynamic for all pages (adverts).

    PHP Code:
        public static function personal_campaign ()
        {
            GLOBAL 
    $config$db;
            
    $query 'SELECT hyperlink, directory, paragraph FROM www_campaign ORDER BY ID LIMIT 10';
            if(
    $statement $db->prepare($query))
            {
                
    $statement->execute();
                
    $statement->store_result();
                if (
    $statement->num_rows 0)
                {
                    
    $statement->bind_result($hyperlink$directory$paragraph);
                    while (
    $statement->fetch())
                    {
                        
    $class = ($x == 0) ? 'odd' 'even';
                        
    $result .= ('<a href="'.$hyperlink.'" target="_self" class="'.$class.'">
                            <div class="campaign-image"><img src="'
    .$config['www']['url'].'/'.$directory.'" alt="" /></div>
                            <div class="campaign-p">'
    .$paragraph.'</div>
                        </a>'
    );
                        
    $x++;
                    }
                }
                else
                {
                    
    $result = ('No campaign(s) to display.');
                }
                
    $statement->close();
            }
            
            return (
    $result);
                
        }
        
        public static function 
    personal_news ()
        {
            GLOBAL 
    $config$db;
            
    $query 'SELECT ID, directory, header FROM www_news ORDER BY ID LIMIT 3';
            if(
    $statement $db->prepare($query))
            {
                
    $statement->execute();
                
    $statement->store_result();
                
    $statement->bind_result($ID$directory$header);
                if (
    $statement->num_rows == 1)
                {
                    if (
    $statement->fetch())
                    {
                        
    $result .= ('<ul id="container-news-button">
                            <li><a href="#news-01" target="_self" class="news-button"></a></li>
                        </ul>
                        <div id="news-01">
                            <div id="container-news">
                                <a href="'
    .$config['www']['url'].'/?p=news&sub='.$ID.'" target="_self" class="news-page">
                                    <div class="news-button-active"></div>
                                    <img src="'
    .$config['www']['url'].'/'.$directory.'" alt="'.$header.'" title="'.$header.'" />
                                    <div class="news-container-title">'
    .$header.'</div>
                                </a>
                            </div>
                        </div>'
    );
                    }
                }
                else if (
    $statement->num_rows == 2)
                {
                    
    $result .= ('<ul id="container-news-button">
                            <li><a href="#news-01" target="_self" class="news-button"></a></li>
                            <li><a href="#news-02" target="_self" class="news-button"></a></li>
                        </ul>
                        <div id="news-01">
                            <div id="news-02">
                                <div id="container-news">
    '
    );
                    while (
    $statement->fetch())
                    {
                        
    $result .= ('                                <a href="'.$config['www']['url'].'/?p=news&sub='.$ID.'" target="_self" class="news-page">
                                        <div class="news-button-active"></div>
                                        <img src="'
    .$config['www']['url'].'/'.$directory.'" alt="'.$header.'" title="'.$header.'" />
                                        <div class="news-container-title">'
    .$header.'</div>
                                    </a>
    '
    );
                    }
                    
    $result .= ('                            </div>
                            </div>
                        </div>'
    );
                }
                else if (
    $statement->num_rows >= 3)
                {
                    
    $result .= ('<ul id="container-news-button">
                            <li><a href="#news-01" target="_self" class="news-button"></a></li>
                            <li><a href="#news-02" target="_self" class="news-button"></a></li>
                            <li><a href="#news-03" target="_self" class="news-button"></a></li>
                        </ul>
                        <div id="news-01">
                            <div id="news-02">
                                <div id="news-03">
                                    <div id="container-news">
    '
    );
                    while (
    $statement->fetch())
                    {
                        
    $result .= ('                                    <a href="'.$config['www']['url'].'/?p=news&sub='.$ID.'" target="_self" class="news-page">
                                            <div class="news-button-active"></div>
                                            <img src="'
    .$config['www']['url'].'/'.$directory.'" alt="'.$header.'" title="'.$header.'" />
                                            <div class="news-container-title">'
    .$header.'</div>
                                        </a>
    '
    );
                    }
                    
    $result .= ('                                </div>
                                </div>
                            </div>
                        </div>'
    );
                }
                else
                {
                    
    $result = ('No news(s) to display.');
                }
                
    $statement->close();
            }
            
            return (
    $result);
                
        }
        
        public static function 
    advertisement ()
        {
            GLOBAL 
    $config$db;
            
    $query 'SELECT hyperlink, directory FROM www_advert ORDER BY RAND() LIMIT 1';
            if (
    $statement $db->prepare($query))
            {
                
    $statement->execute();
                
    $statement->store_result();
                if (
    $statement->num_rows 0)
                {
                    
    $statement->bind_result($hyperlink$directory);
                    if (
    $statement->fetch())
                    {
                        
    $result = ('<a href="'.$hyperlink.'" target="_blank"><img src="'.$config['www']['url'].'/'.$directory.'" alt="" /></a>');
                    }
                }
                else
                {
                    
    $result = ('No ADS to display.');
                }
                
    $statement->close();
            }
            
            return (
    '<div id="container-column-03" class="container-column">
                    <div class="container-title orange">Advertisement</div>
                    <div class="container-body" align="center">'
    .$result.'</div>
                </div>'
    );
        } 
    I'll release a second patch in a download to make things easier, plus the extra tables required. If the variables look out of place it's because I wanted the code look normalised in the source code.

    While I'm still on here, before I sleep. Last function I'll be doing for tonight. I'll post the patch release tomorrow.
    PHP Code:
        public static function paper ($ID)
        {
            GLOBAL 
    $config$db;
            
    $query 'SELECT paragraph FROM www_paper WHERE ID = ? LIMIT 1';
            if (
    $statement $db->prepare($query))
            {
                
    $statement->bind_param('s'$ID);
                
    $statement->execute();
                
    $statement->bind_result($paragraph);
                if (
    $statement->fetch())
                {
                    return (
    $paragraph);
                    
    $statement->close();
                }
                else
                {
                    return 
    false;
                }
            }
        } 

  12. #27
    Account Upgraded | Title Enabled! Predict is offline
    MemberRank
    Aug 2008 Join Date
    760Posts

    Re: [pre-release] dev cms

    The updated version is on the attachment below.

    I've updated a few pieces of the code from class.html and other various pages inside theme/public/

    I'm assuming this is better than the one below:

    New:
    PHP Code:
        public static function personal_news ()
        {
            GLOBAL 
    $config$db;
            
    $query 'SELECT ID, directory, header FROM www_news ORDER BY ID LIMIT 3';
            if (
    $statement $db->prepare($query))
            {
                
    $statement->execute();
                
    $statement->store_result();
                if (
    $statement->num_rows >= 1)
                {
                    
    $statement->bind_result($ID$directory$header);
                    while (
    $statement->fetch())
                    {
                        
    $results .= ('<a href="'.$config['www']['url'].'/?p=news&sub='.$ID.'" target="_self" class="news-page">
                                            <div class="news-button-active"></div>
                                            <img src="'
    .$config['www']['url'].'/'.$directory.'" alt="'.$header.'" title="'.$header.'" />
                                            <div class="news-container-title">'
    .$header.'</div>
                                        </a>
    '
    );
                    }
                }
                
                if (
    $statement->num_rows == 1)
                {
                    
    $result = ('<ul id="container-news-button">
                            <li><a href="#news-01" target="_self" class="news-button"></a></li>
                        </ul>
                        <div id="news-01">
                            <div id="container-news">
                                '
    .$results.'
                            </div>
                        </div>'
    );
                }
                else if (
    $statement->num_rows == 2)
                {
                    
    $result = ('<ul id="container-news-button">
                            <li><a href="#news-01" target="_self" class="news-button"></a></li>
                            <li><a href="#news-02" target="_self" class="news-button"></a></li>
                        </ul>
                        <div id="news-01">
                            <div id="news-02">
                                <div id="container-news">
                                    '
    .$results.'
                                </div>
                            </div>
                        </div>'
    );
                }
                else if (
    $statement->num_rows == 3)
                {
                    
    $result = ('<ul id="container-news-button">
                            <li><a href="#news-01" target="_self" class="news-button"></a></li>
                            <li><a href="#news-02" target="_self" class="news-button"></a></li>
                            <li><a href="#news-03" target="_self" class="news-button"></a></li>
                        </ul>
                        <div id="news-01">
                            <div id="news-02">
                                <div id="news-03">
                                    <div id="container-news">
                                        '
    .$results.'
                                    </div>
                                </div>
                            </div>
                        </div>'
    );
                }
                else
                {
                    
    $result = ('<div id="container-news">
                            <a href="'
    .$config['www']['url'].'/?p=news" target="_self" class="news-page">
                                <div class="news-button-active"></div>
                                <img src="'
    .$config['www']['url'].'/public/images/content/content-news-page-image-error-bg.png" alt="No news articles!" title="No news articles!" />
                                <div class="news-container-title">No news articles!</div>
                            </a>
                        </div>'
    );
                }
                
                
    $statement->close();
            }
                
            return (
    $result);
        } 
    Old:
    PHP Code:
        public static function personal_news ()
        {
            GLOBAL 
    $config$db;
            
    $query 'SELECT ID, directory, header FROM www_news ORDER BY ID LIMIT 3';
            if (
    $statement $db->prepare($query))
            {
                
    $statement->execute();
                
    $statement->store_result();
                
    $statement->bind_result($ID$directory$header);
                if (
    $statement->num_rows == 1)
                {
                    if (
    $statement->fetch())
                    {
                        
    $result .= ('<ul id="container-news-button">
                            <li><a href="#news-01" target="_self" class="news-button"></a></li>
                        </ul>
                        <div id="news-01">
                            <div id="container-news">
                                <a href="'
    .$config['www']['url'].'/?p=news&sub='.$ID.'" target="_self" class="news-page">
                                    <div class="news-button-active"></div>
                                    <img src="'
    .$config['www']['url'].'/'.$directory.'" alt="'.$header.'" title="'.$header.'" />
                                    <div class="news-container-title">'
    .$header.'</div>
                                </a>
                            </div>
                        </div>'
    );
                    }
                }
                else if (
    $statement->num_rows == 2)
                {
                    
    $result .= ('<ul id="container-news-button">
                            <li><a href="#news-01" target="_self" class="news-button"></a></li>
                            <li><a href="#news-02" target="_self" class="news-button"></a></li>
                        </ul>
                        <div id="news-01">
                            <div id="news-02">
                                <div id="container-news">
    '
    );
                    while (
    $statement->fetch())
                    {
                        
    $result .= ('                                <a href="'.$config['www']['url'].'/?p=news&sub='.$ID.'" target="_self" class="news-page">
                                        <div class="news-button-active"></div>
                                        <img src="'
    .$config['www']['url'].'/'.$directory.'" alt="'.$header.'" title="'.$header.'" />
                                        <div class="news-container-title">'
    .$header.'</div>
                                    </a>
    '
    );
                    }
                    
    $result .= ('                            </div>
                            </div>
                        </div>'
    );
                }
                else if (
    $statement->num_rows 0)
                {
                    
    $result .= ('<ul id="container-news-button">
                            <li><a href="#news-01" target="_self" class="news-button"></a></li>
                            <li><a href="#news-02" target="_self" class="news-button"></a></li>
                            <li><a href="#news-03" target="_self" class="news-button"></a></li>
                        </ul>
                        <div id="news-01">
                            <div id="news-02">
                                <div id="news-03">
                                    <div id="container-news">
    '
    );
                    while (
    $statement->fetch())
                    {
                            
    $result .= ('                                    <a href="'.$config['www']['url'].'/?p=news&sub='.$ID.'" target="_self" class="news-page">
                                            <div class="news-button-active"></div>
                                            <img src="'
    .$config['www']['url'].'/'.$directory.'" alt="'.$header.'" title="'.$header.'" />
                                            <div class="news-container-title">'
    .$header.'</div>
                                        </a>
    '
    );
                    }
                        
    $result .= ('                                </div>
                                </div>
                            </div>
                        </div>'
    );
                }
                else
                {
                    
    $result = ('<div id="container-news">
                            <a href="'
    .$config['www']['url'].'/?p=news" target="_self" class="news-page">
                                <div class="news-button-active"></div>
                                <img src="'
    .$config['www']['url'].'/public/images/content/content-news-page-image-error-bg.png" alt="No news articles!" title="No news articles!" />
                                <div class="news-container-title">No news articles!</div>
                            </a>
                        </div>'
    );
                }
                
    $statement->close();
            }
                
            return (
    $result);
        } 
    Attached Files Attached Files

  13. #28
    Account Upgraded | Title Enabled! Predict is offline
    MemberRank
    Aug 2008 Join Date
    760Posts

    Re: [pre-release] dev cms

    I've updated a few things from the last patch ^

    PHP Code:
        public static function paper ($ID)
        {
            GLOBAL 
    $db;
            
    $query 'SELECT paragraph FROM www_paper WHERE ID = ? LIMIT 1';
            if (
    $statement $db->prepare($query))
            {
                
    $statement->bind_param('i'$ID);
                
    $statement->execute();
                
    $statement->bind_result($paragraph);
                if (
    $statement->fetch())
                {
                    return (
    $paragraph);
                    
    $statement->close();
                }
                else
                {
                    return (
    '<p><strong>Page error</strong></p><p>Sorry, but we can\'t find the page you requested.<br /><br />Please try typing the URL again. If you end up back here, please use the \'Back\' button to get back to where you started.</p>');
                }
            }
        } 
    I was looking back at the source and noticed that I binded a string instead of a integer, so that was fixed. You could say I returned a error message if the pages existing in the database are not there, save being a blank document. I do the same normalisation between other functions, such as the home(s) and news.

    PHP Code:
        // Function home is inside the user class
        
        
    public static function news ($ID NULL)
        {
            GLOBAL 
    $db;
            if (
    $ID == NULL)
            {
                
    $statement $db->prepare('SELECT header, paragraph FROM www_news ORDER BY ID DESC LIMIT 1');
            }
            else
            {
                
    $statement $db->prepare('SELECT header, paragraph FROM www_news WHERE ID = ? LIMIT 1');
                
    $statement->bind_param('i'$ID);
            }
            
            
    $statement->execute();
            
    $statement->bind_result($header$paragraph);
            if (
    $statement->fetch())
            {
                return (
    '<div class="container-title orange">'.$header.'</div>
                    <div class="container-body">
                        <p>'
    .$paragraph.'</p>
                    </div>'
    );
                    
    $statement->close();
            }
            else
            {
                return (
    '<div class="container-title orange">Page error</div>
                    <div class="container-body">
                        <p>Sorry, but we can\'t find the page you requested.<br /><br />Please try typing the URL again. If you end up back here, please use the \'Back\' button to get back to where you started.</p>
                    </div>'
    );
            }
        } 
    Two more things, haha......................
    For good practice I've assigned all queries that were being ordered with ASCending and DESCending.

    I haven't got a layout for the staff page, like I have a good idea how to lay the boxes out, and stuff, but I'm curious if anyone has any good looking layouts to order staff members? Like I don't want to pick one out of my own preference (unless I have too), but ye. Contributions would be great XD

  14. #29
    Account Upgraded | Title Enabled! Predict is offline
    MemberRank
    Aug 2008 Join Date
    760Posts

    Re: [pre-release] dev cms

    Seeing as I haven't got a layout (order) for staff members, I added the user table to make sure my home function worked...

    PHP Code:
        public function user_home ($ID)
        {
            GLOBAL 
    $db;
            
    $query 'SELECT username, look FROM users WHERE ID = ? LIMIT 1';
            if (
    $statement $db->prepare($query))
            {
                
    $statement->bind_param('i'$this->user_id($ID));
                
    $statement->execute();
                
    $statement->bind_result($username$look);
                if (
    $statement->fetch())
                {
                    return (
    '<img src="http://www.habbo.nl/habbo-imaging/avatarimage?figure='.$look.'&direction=4&head_direction=4.gif" alt="'.$username.'" align="right" />
                            <strong>My Profile</strong><br /><br />
                            <b><u>'
    .$username.'</u></b>');
                    
    $statement->close();
                }
                else
                {
                    return 
    false// shit
                
    }
            }
            
            return (
    $result);
        } 
    Attached Thumbnails Attached Thumbnails biggest_tits_ever.png  

  15. #30
    Account Upgraded | Title Enabled! Predict is offline
    MemberRank
    Aug 2008 Join Date
    760Posts

    Re: [pre-release] dev cms

    I was reviewing the functions for when either pages do not exist or users, regardless I came up with just putting the error page as return false. I had to make sure that the template global variables were inside the function also.

    PHP Code:
        public function user_home ($ID)
        {
            GLOBAL 
    $db$tpl;
            
    $query 'SELECT  username, look FROM users WHERE ID = ? LIMIT 1';
            if (
    $statement $db->prepare($query))
            {
                
    $statement->bind_param('i'$this->user_id($ID));
                
    $statement->execute();
                
    $statement->bind_result($username$look);
                if (
    $statement->fetch())
                {
                    return (
    '<img src="http://www.habbo.nl/habbo-imaging/avatarimage?figure='.$look.'&direction=4&head_direction=4.gif" alt="'.$username.'" align="right" />
                            <strong>My Profile</strong><br /><br />
                            <b><u>'
    .$username.'</u></b>');
                    
    $statement->close();
                }
                else
                {
                    require_once (
    'private/application/theme/public/error.php');
                    die;
                }
            }
            
            return (
    $result);
        } 
    PHP Code:
        public static function paper ($ID)
        {
            GLOBAL 
    $db$tpl;
            
    $query 'SELECT paragraph FROM www_paper WHERE ID = ? LIMIT 1';
            if (
    $statement $db->prepare($query))
            {
                
    $statement->bind_param('i'$ID);
                
    $statement->execute();
                
    $statement->bind_result($paragraph);
                if (
    $statement->fetch())
                {
                    return (
    $paragraph);
                    
    $statement->close();
                }
                else
                {
                    require_once (
    'private/application/theme/public/error.php');
                    die;
                }
            }
        }

        public static function 
    news ($ID NULL)
        {
            GLOBAL 
    $db$tpl;
            if (
    $ID == NULL)
            {
                
    $statement $db->prepare('SELECT header, paragraph FROM www_news ORDER BY ID DESC LIMIT 1');
            }
            else
            {
                
    $statement $db->prepare('SELECT header, paragraph FROM www_news WHERE ID = ? LIMIT 1');
                
    $statement->bind_param('i'$ID);
            }
            
            
    $statement->execute();
            
    $statement->bind_result($header$paragraph);
            if (
    $statement->fetch())
            {
                return (
    '<div class="container-title orange">'.$header.'</div>
                    <div class="container-body">
                        <p>'
    .$paragraph.'</p>
                    </div>'
    );
                    
    $statement->close();
            }
            else
            {
                require_once (
    'private/application/theme/public/error.php');
                die;
            }
        } 
    I've also reviewed how my functions would be handled inside the actual pages where the functions were being used and I came up with...

    PHP Code:
    $page = isset ($_GET['sub']) ? $_GET['sub'] : 0;

    if (
    $page == NULL || $page)
    {
        
    $initial NULL;
        
        if (
    $page == NULL)
        {
            
    $initial $_SESSION['username'];
        }
        else if (
    $page)
        {
            
    $initial $page;
        }
        
        
    $home->SetParam ('HOME'$usr->user_home ($initial));
    }
    else
    {
        require_once (
    'error.php');
        die;

    So basically if you're logged in you won't require you use the sub $_GET as the page will already load your data, whereas if you wanted to search for someone you would.

    Uhm, I'm working on the news navigation, so you can direct yourself to each page that exists and possibly do the staff page... Would have been nice if someone given me a layout on how to form the staff members, but eh! That's okay XD



Page 2 of 5 FirstFirst 12345 LastLast

Advertisement