Jump to content

[SOLVED] unexpected '='


jordanwb

Recommended Posts

Error:

 

Parse error: syntax error, unexpected '=' in /var/www/scm/core/plugin.php on line 28

 

<?php

abstract class Plugin
{
private $sql_engine;

static public $plugins;

public function __construct (DatabaseEngine $sql_engine)
{
	$this->sql_engine = $sql_engine;
}

public static function load_plugins (DatabaseEngine $sql_engine)
{
	$query = "SELECT * FROM `".$sql_engine->table_prefix."pluigns` WHERE `plugin_enabled`=1";
	$plugins = null;

	if ($result = $sql_engine->query ($query))
	{
		if ($sql_engine->has_rows ($result))
		{
			while ($plugin = $sql_engine->get_next_row ($result))
			{
				include ("plugins/".$plugin["plugin_path"]);
			}

			Plugin::plugins = $plugins;
		}
	}

	return $plugins;
}

public abstract function make_menu ();
public abstract function content ();
}

?>

 

The problem is in the static function load_plugins () on this line:

 

Plugin::plugins = $plugins;

 

Now if there were any plugins in the table $plugins would not be null. It would be an array of classes extending the Plugin class. I have the static variable so plugins can access other installed plugins.

 

[Edit] Loving the new site.  ;D

Link to comment
https://forums.phpfreaks.com/topic/108244-solved-unexpected/
Share on other sites

So why do I in order to access an instance property do $this->property but for a static property I do Class::$property? That makes no sense. It should be

 

$this->property and

Class::property

 

or

 

$this->$property and

Class::$property

 

They're both accessing a property the only difference is whether or not they're static.

 

Anyways it worked.

 

I never got an email saying there was a reply despite selecting that.

Link to comment
https://forums.phpfreaks.com/topic/108244-solved-unexpected/#findComment-555179
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.