0

I installed a brand new, clean Joomla 3.4.5 and then installed a component written by myself, which worked totally fine in Joomla 2.5. In Joomla 3 however, I get server error 500... in some cases...

I narrowed the error down to the following weird situation:

The component is called com_confighdv (I'm extending Joomla core's com_config). I added a view called JustaName, existing of two files:

admin/views/justaname/view.html.php:

<?php
class ConfigHdVViewJustaName extends JViewLegacy
{
}
?>

admin/views/justaname/tmpl/default.php:

Hello world!

This works fine when I go to index.php?option=com_confighdv&view=justaname.

Then I change the view's name from JustaName to Component:

  • The view's folder becomes: admin/views/component/
  • Class declaration becomes: class ConfigHdVViewComponent extends JViewLegacy {}

Now, when I go to index.php?option=com_confighdv&view=component I get a server error 500 :s

I really don't know what to do with this. Help is very much appreciated!

Herman
  • 361
  • 3
  • 13
  • Look in the server logs for the exact error message, that's likely to be the most enlightening thing you can do – Pekka Nov 19 '15 at 10:19
  • Lines in server log (= normal log, error logs are empty): ------- [19/Nov/2015:11:55:24 +0100] "GET /administrator/index.php?option=com_confighdv&view=justaname HTTP/1.1" 200 5693 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36" ---------- and: -------- [19/Nov/2015:11:56:28 +0100] "GET /administrator/index.php?option=com_confighdv&view=component HTTP/1.1" 500 174 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36" – Herman Nov 19 '15 at 11:01
  • I suspect component is already assigned for a view type. Try changing it to comp? Alternatively enable Joomla! Maximum error reporting to view the php error. – tonypartridge Nov 19 '15 at 12:14
  • @XWS Thanks for the hint of enabling Joomla's maximum error reporting! Solved the problem immediately (see my own answer below). Really thought I was already using maximum error reporting, because that is what I want when I am creating extensions... – Herman Nov 19 '15 at 14:57
  • You actually want development when developing ;-). You are welcome! – tonypartridge Nov 19 '15 at 15:00

1 Answers1

0

Solved! Switching to Joomla's maximum error reporting provided the explanation:

Fatal error: Class ConfigHdVModelComponent contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (JModelForm::getForm) in /xxx/administrator/components/com_confighdv/models/component.php on line 18

So, the problem is not in the view, but in the model that belongs to the Component view!

I accidentally created this problem myself, by reducing the model declaration to what I thought was the absolute minimum:

class ConfigHdVModelComponent extends JModelAdmin
{
{

While this is not allowed, because you always have to define the getForm method, so:

class ConfigHdVModelComponent extends JModelAdmin
{
    public function getForm($data = array(), $loadData = true)
    {
    }
{
Herman
  • 361
  • 3
  • 13