Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load Blade v 3.5 and next #47

Closed
ar3s opened this issue Aug 30, 2018 · 8 comments
Closed

Unable to load Blade v 3.5 and next #47

ar3s opened this issue Aug 30, 2018 · 8 comments

Comments

@ar3s
Copy link

ar3s commented Aug 30, 2018

Hi,
I've updated from version 3.4 to version 3.7 without change nothing and the plugin won't load anymore. I'm using BladeWithLang. I've also try to downgrade to version 3.5 and the problem still persist. Version 3.4 is okay.

I'm delegating to Composer autoload the loading. So my situation is the following:

config.php file:

require_once ('../vendor/autoload.php');

MyBladeLang.class.php file:

use eftec\bladeone;
use eftec\bladeone\BladeOneLang;

class MyBladeLang extends bladeone\BladeOne {
use BladeOneLang;
}

index.php file:

$blade = new \MyBladeLang($source, $cache, MyBladeLang::MODE_SLOW);

Since 3.4 this was working correctly. Can you explain me what am I doing wrong that stopped to load the class?

Thanks in advance,
Best Regards,

@jorgecc
Copy link
Member

jorgecc commented Aug 30, 2018

`<?php
require_once ('vendor/autoload.php');

use eftec\bladeone;
use eftec\bladeone\BladeOneLang;

class MyBladeLang extends bladeone\BladeOne {
use BladeOneLang;
}
$views = DIR . '/views';
$compiledFolder = DIR . '/compiled';

$blade = new \MyBladeLang($views, $compiledFolder, MyBladeLang::MODE_SLOW);

$lang='jp'; // try es,jp or fr
include DIR.'/lang/'.$lang.'.php';

try {
echo $blade->run("Lang.test",array('var'=>'1'));
} catch (Exception $e) {
echo "error found ".$e->getMessage()."
".$e->getTraceAsString();
}
`
note: DIR is _ _ DIR _ _

tree
├───compiled
├───lang
├───vendor
│ ├───composer
│ └───eftec
│ └───bladeone
│ └───lib
└───views
└───Lang

@jorgecc jorgecc closed this as completed Aug 30, 2018
@jorgecc
Copy link
Member

jorgecc commented Aug 30, 2018

COMPOSER
{ "name": "jorge/dummy", "type": "project", "require": { "eftec/bladeone": "^3.7" }, "authors": [ { "name": "Jorge Castro", "email": "****" } ] }

@jorgecc jorgecc reopened this Aug 30, 2018
@ar3s
Copy link
Author

ar3s commented Aug 30, 2018

I didn't get sorry, I don't think it's a DIR problem.
It would not work in 3.4 too then, right? Or did you changed it in 3.5+ ?

Mine actually is set to:

DIR . '../views'

@jorgecc
Copy link
Member

jorgecc commented Aug 30, 2018

I tried a new project (the project explained in the code) and it works. I mentioned about the "dir" because of the markdown annotation removes the _ _ character.

Which version of PHP are you using? and, how its fail?
ps: remember to update composer and the autoinclude.

@ar3s
Copy link
Author

ar3s commented Aug 30, 2018

This is the error i receive from my autoload class which loads the MyBladeLang class:

Unable to load the class: Blade (errro code: 2) require (Blade.php): failed to open stream: No such file or directory

anyway I can't understand why in 3.4 and older works and 3.5 and newer dont.

@jorgecc
Copy link
Member

jorgecc commented Aug 31, 2018

Where are you trying to load the class name "Blade"?.
If the class blade exists, then bladeone will try to load it as a namespace class.

@ar3s
Copy link
Author

ar3s commented Aug 31, 2018

Hi,
just to inform you I have solved the problem.
I have excluded the Blade class to be loaded automatically and now it works correctly. :)
Sorry for the long troubleshooting. Keep up the great job! 👍

@jorgecc
Copy link
Member

jorgecc commented Sep 1, 2018

I am planning to remove Blade class anyways.
I added it because we could use the library as a static Blade::operation(). However, the idea is silly (even when Laravel uses it), why?.

  • Blade should be in the namespace root.
  • The target of BladeOne is to create a single-class file (excepting extensions).
  • global is less than elegant but it works and it's less bloated.
  • And using static call is only syntax sugar.

https://github.com/EFTEC/BladeOne/releases/tag/3.8

@jorgecc jorgecc closed this as completed Sep 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants