Page 1 of 1

issues in PHP5?

Posted: Wed Jan 27, 2010 7:56 am
by glennnall
i'm using an older script which seems to be causing problems in PHP5...

Code: Select all

 
 
 
class tpl_Magic
{
    private $directory;
    private $config;
    private $templates = array();
    private $variables = array();
 
 
    public function __construct($directory)
    {
        $this->directory = $directory;
        $this->templates['variables'] = array();
        $this->templates['tplfiles']  = array();
        $this->variables['names']     = array();
        $this->variables['values']    = array();
    }
 
 
causing "unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' " at line 27... [ $this->directory = $directory; ]

is there anything i can do with this to make it work?

thanks
gn

Re: issues in PHP5?

Posted: Wed Jan 27, 2010 8:17 am
by requinix
Are you sure you have the right line number, and are you sure you're using PHP 5?

Re: issues in PHP5?

Posted: Wed Jan 27, 2010 8:35 am
by nothing1306
I think that he said:
i'm using an older script which seems to be causing problems in PHP5...
I found that error here:
http://www.wiziq.com/forum/messages.aspx?TopicID=12

Do you use .htaccess file?

Re: issues in PHP5?

Posted: Wed Jan 27, 2010 9:29 am
by glennnall
tasairis wrote:Are you sure you have the right line number, and are you sure you're using PHP 5?
a) no, i had the wrong line # - it was [ private $directory; ] :o), sorry...

b) no, i had the PHP version wrong. it's written for 5, and godaddy is running 4.4.9.

other than that, i was right.


:o)

thanks, ya'll

Re: issues in PHP5?

Posted: Wed Jan 27, 2010 9:49 am
by requinix
PHP 4 doesn't support access modifiers: private, public, and protected.
Get rid of them.
Also rename __construct to whatever the name of the class is - for that one, use function tpl_Magic($directory).

You'll probably find a number of other problems. Your best option is to upgrade - PHP 4 is dead and buried.

Re: issues in PHP5?

Posted: Wed Jan 27, 2010 10:03 am
by glennnall
yes, i've asked godaddy 'what's up with that?'...

thanks