Jump to content

Problem with kp-1 autoloading -classes-with-namespaces part 3


seamoh

Recommended Posts

Hello all , I use zend studio for practicing killer php advanced series as the tutorial says:

I use the following codes:

 

<?php

define('APPLICATION_PATH', realpath('../'));

$paths = array (

APPLICATION_PATH,

APPLICATION_PATH.'/com',

get_include_path()

 

);

set_include_path(implode(PATH_SEPARATOR, $paths));

var_dump(get_include_path());

echo "<br />";

 

 

 

function __autoload($className)

{

$filename = str_replace('\\', '/', $className);

require_once $filename;

 

}

use \com\killerphp\models as Models;

 

//require_once ('User.php');

$user = new User();

echo $user->getName();

?>

zend studio shows me this error syntax error, unexpected 'com', expecting '(' besides the use \com\killerphp\models as Models;

it seems that zend studio has a problem with this syntax , I should mention that I use windows xp.

Sincerely yours seamoh

Link to comment
Share on other sites

Have you tested this outside of Zend Studio, accessing the code through localhost? When I test the code, I do get errors saying it can't find the User.php file, but I'm not getting the syntax error that you say you get, which makes me think that maybe Zend Studio is getting confused.

You are completely right Ben ,I accessed it through localhost and it worked . but it seems that we should change the code in oreder that zend studio will be able to parse the code ,what is your idea?

Sincerely yours

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...