By Jostein Rosenlund on Saturday, 21 December 2013
Posted in Technical Issues
Replies 1
Likes 0
Views 1.2K
Votes 0
This is the current code, that iv inserted into:

My Model Looks like this:

class phealModel extends EasySocialModel

{
public function getList( $userId ) {

$path = realpath(".")."/media/com_easysocial/apps/user/epoma/vendor/autoload.php";
require_once $path;

//import namespace
use Pheal\Pheal;

// create pheal object with default values
// so far this will not use caching, and since no key is supplied
// only allow access to the public parts of the EVE API
$pheal = new Pheal();

// requests /server/ServerStatus.xml.aspx
$response = $pheal->serverScope->ServerStatus();

echo sprintf(
"Hello Visitor! The EVE Online Server is: %s!, current amount of online players: %s",
$response->serverOpen ? "open" : "closed",
$response->onlinePlayers
);

}}

"]


But i have an issue implementing the use into the code.
use Pheal\Pheal;

It prints out the following error.

Parse error: syntax error, unexpected 'use' (T_USE) in /media/com_easysocial/apps/user/epoma/models/pheal.php on line 52

How can i fix this?

sourcecode for the includes can be found here:
https://github.com/3rdpartyeve/phealng

fixed it:

Foundry::import( 'admin:/includes/model' );


$path = realpath(".")."/media/com_easysocial/apps/user/epoma/vendor/autoload.php";
require_once $path;
use Pheal\Pheal;


class phealModel extends EasySocialModel

{




public function getList( $userId ) {


//import namespace


// create pheal object with default values
// so far this will not use caching, and since no key is supplied
// only allow access to the public parts of the EVE API
$pheal = new Pheal();

// requests /server/ServerStatus.xml.aspx
$response = $pheal->serverScope->ServerStatus();

echo sprintf(
"Hello Visitor! The EVE Online Server is: %s!, current amount of online players: %s",
$response->serverOpen ? "open" : "closed",
$response->onlinePlayers
);

}}
Thanks for updating Jostein You need to use the "USE" outside of the function scope :P
·
Saturday, 21 December 2013 13:02
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post