View Single Post
Old 11-19-2008, 02:05 AM   #6 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

In keeping with your style, however, I have created this for you, with a little debug functionality as well, just in case you require it.

php Code:
class Customisation
{
    private static $m_aData;
    const THROW_EXCEPTIONS = false;
   
    public static function getLine($iLine)
    {
        if (empty(self::$m_aData))
        {
            self::$m_aData = file('setting.txt');
        }
       
        if (!isset(self::$m_aData[$iLine - 1]))
        {
            if (self::THROW_EXCEPTIONS)
            {
                throw new Exception(sprintf('Line %d does not exist', $iLine));
            }
           
            return null;
        }
       
        return self::$m_aData[$iLine - 1];
    }
}

echo Customisation::getLine(3);

Then you can use it as so:

php Code:
if (Customisation::getLine(5) == 'colored')
{
    echo 'Do this';
}
else
{
    echo 'Do something else';
}
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote