Something wrong with PHP Novice to NInja branche CMS-Entrypoint-Autoload

Hi every body,
Please let me short introduce myself.
I am an amateur progammer from the Netherlands. I wrote and maintained a datasite for entering observations of ringed wildlife birds via procedural programming. I learned a lot in more than 10 years, but the website stuck into patchwork. You will recognise that :upside_down_face: I decided to study OOP and I chose for the sitepoint issue of Tom Butler, mentioned in the title.
I am new here and I have very seldom before been or fora. So a very big Newby.
Parallel to the book is a Github place. Here I downloaded the different branches as making progress in the book.
Now I am in chapter 9 dowloading this branche

This works fine except when trying to delete
This is the error report:

**Fatal error**: Uncaught Error: Call to undefined method JokeController::joke() in /var/www/vhosts/cr-reading.nl/ninja.cr-reading.nl/classes/EntryPoint.php:21 Stack trace: #0 /var/www/vhosts/cr-reading.nl/ninja.cr-reading.nl/index.php(12): EntryPoint->run() #1 {main} thrown in **/var/www/vhosts/cr-reading.nl/ninja.cr-reading.nl/classes/EntryPoint.php** on line **21**

Except learning to write OOP I also have to learn interpret the errors in a for me very new OOP environment.
So I have to learn 2 qualities.

Could anybody help me at this point.

Is there maybe a list of possible mistakes in the code?
TXS in advance, Henk

In your files on your computer, what does line 4 of classes/JokeWebsite.php look like?

I feel like this would only be possible if line 4 looked like return 'joke/joke/home';

Here it is:
return ‘joke/home’;

I see a difference in the adress bar.
all items look like https://website.nl/joke/list.
If I press the delete button I see the adres is of another format:
https://website.nl/joke/index.php?action=list

Can this be te start of a solution?

Something seems wrong. What does line 16 of templates/jokes.html.php say? It should be pointing at /joke/delete ?

The solution is: in JokeController:
replace this:
header(‘location: index.php?action=list’);
By this
header(‘location: /joke/list’);
I think the original line is a part of a former constuction from earlier in the book.
I will inform Tom Butler about it
Thanks for thinking with me!
Case closed

1 Like

Good to hear you found it… Lets see if we can poke the man a little bit just to make him aware.
@TomB