×
Please submit new Bug Reports on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues
Fatal error: Cannot declare class - Joomla 3.7
Carl Willingham
New Member
Posts: 3
7 年 6 个月 前 #1568
由 Carl Willingham
Replied by Carl Willingham on topic Fatal error: Cannot declare class - Joomla 3.7
The OP made an error with the path, it should be:
/administrator/components/com_example
He forgot the components directory
/administrator/components/com_example
He forgot the components directory
Please 登录 或 注册一个帐号 to join the conversation.
Carl Willingham
New Member
Posts: 3
7 年 6 个月 前 #1569
由 Carl Willingham
Replied by Carl Willingham on topic Fatal error: Cannot declare class - Joomla 3.7
If your component is com_example
The path would be: /administrator/components/com_example
There would not be any line of code with ExampleHelpersExample
It would be ExampleHelper
The path would be: /administrator/components/com_example
There would not be any line of code with ExampleHelpersExample
It would be ExampleHelper
Please 登录 或 注册一个帐号 to join the conversation.
George Taylor
New Member
Posts: 5
7 年 6 个月 前 #1570
由 George Taylor
Replied by George Taylor on topic Fatal error: Cannot declare class - Joomla 3.7
I started searching and replacing and then realised it was a lot of work.
This might help if you want to avoid RSI.
sudo find ./ -type f -exec sed -i 's/ExampleHelpersExample:/ExampleHelpersExampleAdmin:/g' {} \;
This might help if you want to avoid RSI.
sudo find ./ -type f -exec sed -i 's/ExampleHelpersExample:/ExampleHelpersExampleAdmin:/g' {} \;
Please 登录 或 注册一个帐号 to join the conversation.
Søren Beck Jensen
Administrator
Posts: 73
7 年 6 个月 前 #1571
由 Søren Beck Jensen
Søren Beck Jensen
Founder, Component-Creator.com
Replied by Søren Beck Jensen on topic Fatal error: Cannot declare class - Joomla 3.7
We do not expect Joomla to reverse their change in 3.7.1 so this should be fixed. One thing to note though is that this only affects components that use our front end views.Do you have idea if this issue will remain or be fixed in upcoming 3.7.1 for example?
This issue is not related to the issue with Component Creator.Any other problems affecting component creator like these mentioned here: www.akeebabackup.com/home/news/1676-joom...and-cli-scripts.html
Joomla 3.7 introduced a new check that prevents two classes to have the same name (even though the documentation still says the two should be named the same way)Can you please tell us which change in Joomla 3.7 caused this and any other compatibility break?
You should do that yes, but it is as you say because you have an old version of a component. We now use the JLoader library to load helpers and no further editing is needed (if you had built your component the last few months).And should you not rename that file in the view.html.php files
Yes. Recursive. That folder and sub folders.So, I just want to confirm the search is not recursive right ?
Søren Beck Jensen
Founder, Component-Creator.com
The following user(s) said Thank You: Gosling Cools
Please 登录 或 注册一个帐号 to join the conversation.
nigel
New Member
Posts: 3
7 年 6 个月 前 #1572
由 nigel
Replied by nigel on topic Fatal error: Cannot declare class - Joomla 3.7
Unfortunately, this doesn't work for me. The front end is now ok, but the backend will not allow me to add, or edit any existing entries in my table. Hitting anything other than 'cancel' results in a blank screen, with no errors.
These are the files that were changed:
helpers/beers3admin.php:class Beers3HelpersBeers3admin
helpers/beers3admin.php:class Beers3Helper extends Beers3HelpersBeers3admin
views/beers/view.html.php: Beers3HelpersBeers3admin::addSubmenu('beers');
views/beers/view.html.php: $canDo = Beers3HelpersBeers3admin::getActions();
views/beer/view.html.php: $canDo = Beers3HelpersBeers3admin::getActions();
Any help gratefully received.
These are the files that were changed:
helpers/beers3admin.php:class Beers3HelpersBeers3admin
helpers/beers3admin.php:class Beers3Helper extends Beers3HelpersBeers3admin
views/beers/view.html.php: Beers3HelpersBeers3admin::addSubmenu('beers');
views/beers/view.html.php: $canDo = Beers3HelpersBeers3admin::getActions();
views/beer/view.html.php: $canDo = Beers3HelpersBeers3admin::getActions();
Any help gratefully received.
Please 登录 或 注册一个帐号 to join the conversation.
George Taylor
New Member
Posts: 5
7 年 6 个月 前 #1574
由 George Taylor
Replied by George Taylor on topic Fatal error: Cannot declare class - Joomla 3.7
Nigel,
I couldn't get the back end to work either as Joomla couldn't find the new help file Søren told us to create.
So I added it using an include in the top level file for the components admin.
Edit: administrator/components/com_beers3/beers3.php
and add this line after the defined('_JEXEC') or die;
require_once JPATH_COMPONENT . '/helpers/beers3admin.php';
That worked for me on both components.
I couldn't get the back end to work either as Joomla couldn't find the new help file Søren told us to create.
So I added it using an include in the top level file for the components admin.
Edit: administrator/components/com_beers3/beers3.php
and add this line after the defined('_JEXEC') or die;
require_once JPATH_COMPONENT . '/helpers/beers3admin.php';
That worked for me on both components.
The following user(s) said Thank You: Søren Beck Jensen
Please 登录 或 注册一个帐号 to join the conversation.
创建页面时间:0.127秒