404 with copied code from docs Topic is solved

For Joomla! 4.x Coding related discussions, please use: http://groups.google.com/group/joomla-dev-general

Moderator: ooffick

Forum rules
Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.
Post Reply
User avatar
JurajB
Joomla! Guru
Joomla! Guru
Posts: 537
Joined: Fri Oct 02, 2015 3:28 pm

404 with copied code from docs

Post by JurajB » Sun Aug 07, 2022 9:18 am

Hello!

I have copied code from
https://docs.joomla.org/J4.x:Developing ... _Site_Part

when I click "Hello World" in components this happens:
Component not found.

also
http://localhost/joomla/index.php?optio ... view=hello
is not found

Something wrong with my config? I use xampp 8.1.6
php 8.1.6
mariadb 10.8.3

User avatar
JurajB
Joomla! Guru
Joomla! Guru
Posts: 537
Joined: Fri Oct 02, 2015 3:28 pm

Re: 404 with copied code from docs

Post by JurajB » Sun Aug 07, 2022 9:41 am

maybe its antivirus or something with my filesystem?

User avatar
JurajB
Joomla! Guru
Joomla! Guru
Posts: 537
Joined: Fri Oct 02, 2015 3:28 pm

Re: 404 with copied code from docs

Post by JurajB » Mon Aug 08, 2022 2:03 pm

Hello!
Please somebody test:
http://jurajbevilaqua.com/com_helloworld.zip

Instructions:
1. test in backend (admin) clicking onto Hello World! within components and see what happens
2. test this component in your joomla index.php file (frontend) with index.php?option=com_helloworld&view=hello

Thanks you very much!

SharkyKZ
Joomla! Hero
Joomla! Hero
Posts: 2311
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: 404 with copied code from docs

Post by SharkyKZ » Mon Aug 08, 2022 3:23 pm

The service provider should be in services/provider.php, not in services/provider/provider.php.

User avatar
JurajB
Joomla! Guru
Joomla! Guru
Posts: 537
Joined: Fri Oct 02, 2015 3:28 pm

Re: 404 with copied code from docs

Post by JurajB » Tue Aug 09, 2022 8:21 am

Thanks SharkyKZ, I am sorry for that! I mess everything that I do not copy it seems.
Now the second problem appears:
When I click Hello World in backend > components this error appears:
404
View not found [name, type, prefix]: hello, html, Administrator

SharkyKZ
Joomla! Hero
Joomla! Hero
Posts: 2311
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: 404 with copied code from docs

Post by SharkyKZ » Tue Aug 09, 2022 8:31 am

You have no views in backend. A view is included in the package but is not installed. You use src directory for code but the View folder is still in top level directory.

User avatar
JurajB
Joomla! Guru
Joomla! Guru
Posts: 537
Joined: Fri Oct 02, 2015 3:28 pm

Re: 404 with copied code from docs

Post by JurajB » Fri Aug 12, 2022 8:21 am

why its not installed ?
they say:
Once the component is installed, click the "Components" section of the menu on the left of the admin panel. You should now see a new link under this section labelled "Hello World". This is the link detailed in the component's manifest file. If you click it, you should see the "Hello World" page.

SharkyKZ
Joomla! Hero
Joomla! Hero
Posts: 2311
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: 404 with copied code from docs

Post by SharkyKZ » Fri Aug 12, 2022 8:26 am

The View directory is not installed. It's in the wrong directory inside the ZIP package. You currently have these directories:

Code: Select all

services
src
tmpl
View
But your file list is this:

Code: Select all

<files folder="admin/">
    <folder>services</folder>
    <folder>src</folder>
    <folder>tmpl</folder>
</files>
You need to move "View" so it's inside "src", alongside with "Controller".

User avatar
JurajB
Joomla! Guru
Joomla! Guru
Posts: 537
Joined: Fri Oct 02, 2015 3:28 pm

Re: 404 with copied code from docs

Post by JurajB » Fri Aug 12, 2022 8:42 am

Thanks!
Working fine!
* solved

User avatar
JurajB
Joomla! Guru
Joomla! Guru
Posts: 537
Joined: Fri Oct 02, 2015 3:28 pm

Re: 404 with copied code from docs

Post by JurajB » Fri Aug 12, 2022 8:56 am

hm the frontend isnt working
https://docs.joomla.org/J4.x:Developing ... _Site_Part
index.php?option=com_helloworld&view=hello
should be hello world
its
The requested page can't be found.
my actual zip file is here:
https://easyupload.io/9g935c

SharkyKZ
Joomla! Hero
Joomla! Hero
Posts: 2311
Joined: Fri Jul 05, 2013 10:35 am
Location: Parts Unknown

Re: 404 with copied code from docs

Post by SharkyKZ » Fri Aug 12, 2022 9:00 am

No files are installed in frontend. Why did you remove this from the manifest:

Code: Select all

<files folder="site/">
        <folder>src</folder>
        <folder>tmpl</folder>
    </files>
?

User avatar
JurajB
Joomla! Guru
Joomla! Guru
Posts: 537
Joined: Fri Oct 02, 2015 3:28 pm

Re: 404 with copied code from docs

Post by JurajB » Fri Aug 12, 2022 9:26 am

probably some version conflict
now its working anyway
* solved


Post Reply

Return to “Joomla! 4.x Coding”