Problem Trying "Hello World" Component

578 zobrazení
Preskočiť na prvú neprečítanú správu

Mark Dexter

neprečítané,
11. 6. 2022, 13:17:1311. 6. 2022
komu: Joomla! General Development
I'm trying to follow the J4.X Developing an MVC Component tutorial (which evidently is still under construction). This is available at https://docs.joomla.org/J4.x:Developing_an_MVC_Component/.

I can do step 2 (admin view) but when I try to do step 3 (site view) I get the error message "Invalid controller class: display".

For reasons I don't understand, the DisplayController class (in components/com_helloworld/src/Controller folder) doesn't seem to get loaded.

I checked the administrator/cache/autoload_ps4.php file and there are two lines in there as follows:

    'JohnSmith\\Component\\HelloWorld\\Administrator\\' => [JPATH_ADMINISTRATOR . '/components/com_helloworld/src'],
    'JohnSmith\\Component\\HelloWorld\\Site\\' => [JPATH_SITE . '/components/com_helloworld/src'],

So I think this is OK.

Any ideas about how to troubleshoot would be much appreciated. Thanks!



MarkRS

neprečítané,
11. 6. 2022, 13:35:5711. 6. 2022
komu: Joomla! General Development
My favourite troubleshooting, and in fact development, "trick" is to develop with an IDE, I use Netbeans for php code, and use a mixture of single stepping and setting breakpoints to see what'a actually happening where.

Glenn Arkell

neprečítané,
11. 6. 2022, 16:53:0311. 6. 2022
komu: Joomla! General Development
Just checked my DisplayController and I have a construct function as well as the display.
    public function __construct($config = array(), MVCFactoryInterface $factory = null, $app = null, $input = null)
    {
        parent::__construct($config, $factory, $app, $input);
    }

Is this what is missing perhaps?  Cheers.

MarkRS

neprečítané,
12. 6. 2022, 3:44:4012. 6. 2022
komu: Joomla! General Development
If that's all that's in it, I don't suppose that's what's missing because, as it does nothing but pass its parameters on to its parent, it's not required at all.

Hannes Papenberg

neprečítané,
12. 6. 2022, 3:47:3012. 6. 2022
komu: Joomla! General Development
Do you have the correct namespace used in the file? Check if the file is included by placing some debug code outside of the class. Is the capitalization of the filename correct?

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/joomla-dev-general/e6ba298e-3455-432f-a880-890cbbe48c0an%40googlegroups.com.

Cliff

neprečítané,
14. 6. 2022, 8:24:0714. 6. 2022
komu: Joomla! General Development
One thing I notice is that the tutorial does not include mention of administrator/com_helloworld/src/Extension/HelloworldComponent.php (see any other component for an example).

This tutorial was prepared in December 2020 so I guess is out of date. You could look at https://github.com/ceford/j4xdemos-com-bpsrc which is something I put together as part of another tutorial. You could also look at https://github.com/ceford/j4xdemos-com-countrybase which is the code for that other tutorial. Each can be installed and picked apart to see how they work. And  https://docs.joomla.org/J4.x:Links:_MVC_Anatomy is that other tutorial.

Fernando Goncalves

neprečítané,
17. 6. 2022, 16:12:2717. 6. 2022
komu: joomla-de...@googlegroups.com, dexter...@gmail.com
Hi

See if one this variants hellp you.

helloworld04.zip
helloworld03.zip
Odpovedať všetkým
Odpovedať autorovi
Poslať ďalej
0 nových správ