issues in PHP5?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
glennnall
Forum Newbie
Posts: 13
Joined: Wed Jan 27, 2010 7:54 am

issues in PHP5?

Post 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
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: issues in PHP5?

Post by requinix »

Are you sure you have the right line number, and are you sure you're using PHP 5?
nothing1306
Forum Newbie
Posts: 4
Joined: Tue Jan 26, 2010 6:18 am

Re: issues in PHP5?

Post 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?
glennnall
Forum Newbie
Posts: 13
Joined: Wed Jan 27, 2010 7:54 am

Re: issues in PHP5?

Post 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
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: issues in PHP5?

Post 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.
glennnall
Forum Newbie
Posts: 13
Joined: Wed Jan 27, 2010 7:54 am

Re: issues in PHP5?

Post by glennnall »

yes, i've asked godaddy 'what's up with that?'...

thanks
Post Reply