getherbert / herbert

The WordPress Plugin Framework:
http://getherbert.com/
632 stars 94 forks source link

route in admin #135

Closed imajim closed 7 years ago

imajim commented 8 years ago

Hello,

How to create route in admin ? I wrote this : Inner route.php (loaded)

$router->get([
        'as'   => 'printFiche',
        'uri'  => '/wp-admin/admin/print-fiche-{postId}',
        'uses' => __NAMESPACE__ . '\Controllers\AnnonceController@printFiche'
    ]);

And the controller :

public function printFiche($postId)
    {
        var_dump($postId);
        die('toto');
    }

But i've got a blank screen.

Thx for help.

giwrgos88 commented 8 years ago

@imajim did you tried the route to work first without any parameter? second, the blank screen indicates that there is an issue. do you have debug enable?

sajadghawami commented 8 years ago

@imajim i tried your code, and it seems to work, i tried it with this route:

/wp-admin/admin/print-fiche-12
jeremyzahner commented 8 years ago

@imajim Is this issue still present for you?

imajim commented 7 years ago

Hi,

Sorry for my later response ^^

i juste change : '/wp-admin/admin/print-fiche-{postId}', by '/admin/print-fiche-{postId}',

and it's ok ! ^^