Welcome, Guest
Username: Password: Remember me

TOPIC: [FIXED] JViewLegacy Class - Fatal Error Cannot Redeclare

JViewLegacy Class - Fatal Error Cannot Redeclare 28 Aug 2013 15:01 #10921

  • rnevins
  • rnevins's Avatar
  • Offline
  • Junior Member
  • Posts: 24
  • Thank you received: 6
  • Karma: 1
First let me start off by saying that I think this component creator is a great tool. It has taken me some time to get comfortable (on some level) with customizing the resultant component. I have been using the fork system extensively and it is working very well for me. I am not always certain where to put my customizations so there is a lot of trial and error but the more I use the Cook component generator the easier it is getting and the more productive I am becoming.

Now to the main point of this post. I am using the Joolart T3 template which is a responsive framework built around Bootstrap. However, unless I put in a small hack into the administrator/helpers/mvc.php file, I get Fatal error: Cannot redeclare class JViewLegacy, since I think the T3 template has already declared it. So I simply put a conditional in the mvc.php file:

if (!class_exists('JViewLegacy', false)){
jimport('legacy.view.legacy');
}

I have tried to copy this hacked mvc.php file to the fork directory but it doesn't execute it so I find I just have to re-apply the hack every time I install an updated version of my component.

So my questions are:

1. Is this a change that can be built into the code generated by Cook? Maybe this is just an isolated case of wrong coding on the part of Joomart in which case that probably doesn't make sense and

2. If the answer to the first question is "no", then is there a way I can put this change into a fork file somewhere?

Thanks for your help!

Rick
The administrator has disabled public write access.

JViewLegacy Class - Fatal Error Cannot Redeclare 05 Sep 2013 13:25 #11000

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
This is strange because jimport() should be able to manage this.
I can check in mvc.php, but it is a problem of Joomla I do not want to fix that way.
Coding is now a piece of cake
The administrator has disabled public write access.

JViewLegacy Class - Fatal Error Cannot Redeclare 05 Sep 2013 13:34 #11002

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Fixed anyway, so the component is checking before to call jimport().
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: rnevins

JViewLegacy Class - Fatal Error Cannot Redeclare 11 Sep 2013 20:05 #11067

  • rnevins
  • rnevins's Avatar
  • Offline
  • Junior Member
  • Posts: 24
  • Thank you received: 6
  • Karma: 1
Thanks for doing this, but I see you put it in only for the case of Joomla 1.7. I am using Joomla 3.1 so I still have to make the change again after I re-install.

Rick
The administrator has disabled public write access.

JViewLegacy Class - Fatal Error Cannot Redeclare 23 Sep 2013 17:41 #11150

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Try again now... It should work. I don't understand.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.086 seconds

Get Started