MyCademy / yii2-bootstrap-tour

Yii 2 Bootstrap Tour Extension
Apache License 2.0
3 stars 5 forks source link

Class 'MyCademy\BootstrapTour\Tour' not found #6

Open maxodrom opened 8 years ago

maxodrom commented 8 years ago

In composer.json (require section):

"sorich87/bootstrap-tour": "dev-master",
"mycademy/yii2-bootstrap-tour": "dev-master",

In view am using:

use yii\web\View;
use yii\bootstrap\Html;
use MyCademy\BootstrapTour\Tour;

$tour = new MyCademy\BootstrapTour\Tour([
    'scope' => 'window', //Set scope to make the 'tour' variable global
    'startMode' => Tour::START_MODE_INIT_ONLY, //Only initialize the tour
    'clientOptions' => [ //Bootstrap Tour Options, see: http://bootstraptour.com/api/
        'steps' => [
            [
                'element' => "#tour-el1",
                'title' => "step 1",
                'content' => "test 1",
            ],
            [
                'element' => "#tour-el2",
                'title' => "step 2",
                'content' => "test2",
            ],
        ],
    ],
]);

$tour->run();

And i am got error: PHP Fatal Error – yii\base\ErrorException Class 'MyCademy\BootstrapTour\Tour' not found

On my Windows environment - all is OK, but in hosting environment (Linux) - error occured! Maybe this is a bug due to case sensitive namespace?

What is wrong in my code? Help me please.

rhertogh commented 8 years ago

Hi Maxodrom,

can you try it with: $tour = new Tour([

when you import the class with use MyCademy\BootstrapTour\Tour; you should only use the class name itself, otherwise php will try to look for the class relative to the namespace of your own class.

maxodrom commented 8 years ago

Yes, I tried. Same problem...

maxodrom commented 8 years ago
use yii\web\View;
use yii\bootstrap\Html;
use MyCademy\BootstrapTour\Tour;

$tour = new Tour([
    'scope' => 'window', //Set scope to make the 'tour' variable global
    'startMode' => Tour::START_MODE_INIT_ONLY, //Only initialize the tour
    'clientOptions' => [ //Bootstrap Tour Options, see: http://bootstraptour.com/api/
        'steps' => [
            [
                'element' => "#tour-el1",
                'title' => "step 1",
                'content' => "test 1",
            ],
            [
                'element' => "#tour-el2",
                'title' => "step 2",
                'content' => "test2",
            ],
        ],
    ],
]);

$tour->run();

The problem remains.

rhertogh commented 8 years ago

Are you sure your 'vendor' map on the linux server is up-to-date?

maxodrom commented 8 years ago

Yes, I installed the packages today: Updating dependencies (including require-dev)

rhertogh commented 8 years ago

But only locally on your windows pc?

maxodrom commented 8 years ago

Packages are correctly installed on my local project copy and on hosting (remotly). But on my Windows local project copy all is working correctly, but on linux-hosting the problem is occurred.

Construction:

use MyCademy\BootstrapTour\Tour;
$tour = new Tour([...

correctly works on Windows, but not in Linux. Maybe the problem is just that?

rhertogh commented 8 years ago

We're using the same code on both windows and linux, so I don't think that can be the problem. I'll have to investigate further.

maxodrom commented 8 years ago

Yes, the code base is the same on windows and linux.

Consider that:

In my view I have the follow:

use yii\web\View;
use yii\bootstrap\Html;
use rmrevin\yii\fontawesome\FA;
use MyCademy\BootstrapTour\Tour;

For example construction:

use rmrevin\yii\fontawesome\FA;
echo FA::icon(FA::_REFRESH);

works correctly, but yours (on linux) is not. Only on Windows.

maxodrom commented 8 years ago

And did you check your code on Linux env? In my code I am using your approach accorging your manual.

rhertogh commented 8 years ago

Yes, runs without any difference CentOS 7

maxodrom commented 8 years ago

Hmm... ok. I will check this and create ticket in hosting support. Thanks.