Welcome Guest, Not a member yet? Register   Sign In
Parameter passing through routing problem
#1

I have a little routing problem, that i can't solve in Codeigniter 4.
I try adding a parameter at deleting list item. But get the following error messages.

> Error message at post routing: Controller or its method is not found:
> \App\Controllers\Userfeed::delete

> Error message at add or get routing: Controller or its method is not found:
> \App\Controllers\Pages::index

the route part:

Code:
[color=#333333][size=small][font=Tahoma, Verdana, Arial, sans-serif]//$routes->add('userfeed/(:any)', 'Pages/UserFeed::delete');//this works fine[/font][/size][/color]
[color=#333333][size=small][font=Tahoma, Verdana, Arial, sans-serif]$routes->get('userfeed/(:any)', 'Pages/UserFeed::delete');//this works fine[/font][/size][/color]
[color=#333333][size=small][font=Tahoma, Verdana, Arial, sans-serif]//$routes->get('userfeed/(:any)', 'Pages/UserFeed::delete/$1');//this is not work, which is the goal[/font][/size][/color]
[color=#333333][size=small][font=Tahoma, Verdana, Arial, sans-serif]//$routes->post('userfeed/(:any)', 'Pages/UserFeed::delete/$1');//this is not work[/font][/size][/color]
[color=#333333][size=small][font=Tahoma, Verdana, Arial, sans-serif]//$routes->add('userfeed/(:any)', 'Pages/UserFeed::delete/$1');//this is not work[/font][/size][/color]


the controller:

Code:
namespace App\Controllers\Pages;
use App\Controllers\MainCtrl;
...
class UserFeed extends MainCtrl{
....
public function delete($id=FALSE)
    {
        var_dump('wooot?');
        var_dump($id);
    }
}



the view part:
Code:
....
<a class="badge badge-secondary" href="<?php echo base_url('userfeed/delete/'.$rss['id']);?>" >Töröl</a>
....


If need more information let it with me know. 

Thanks your help! Smile
Reply


Messages In This Thread
Parameter passing through routing problem - by csbb - 02-05-2021, 08:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB