how to Custom route creation

TheYkk
Member | 3
+
0
-

i need router
base url http://localhost/…r/nette/www/

i want http://localhost/…te/www/ykk/2
to Ykk class show function and id parameter 2 run
i get eror Page not found. Missing template ‘D:\Program\XAMPP\htdocs\denemeler\nette\app\presenters\templates\Ykk\show.latte’. create file► search►

how i can disable template

Last edited by TheYkk (2018-11-20 15:35)

David Matějka
Moderator | 6445
+
0
-

Hi, according to the error message, the router is correct. why do you want to “disable template”? you don't want to show html response to a user? or what is an expected response?

TheYkk
Member | 3
+
0
-

David Matějka wrote:

Hi, according to the error message, the router is correct. why do you want to “disable template”? you don't want to show html response to a user? or what is an expected response?

i only show direct text or debug array like sample print_r($array);
i dont want show template

TheYkk
Member | 3
+
0
-

maybe I'd like to do a few things and just redirect. how do I disable template it?

David Matějka
Moderator | 6445
+
+1
-

there are quite many ways how to terminate presenter execution and send a response before rendering a template. You can find an overview in a doc

for you, $this->terminate() is probably the method you are looking for.

maybe I'd like to do a few things and just redirect.

redirect also terminates presenter execution

hsynucak
Member | 8
+
0
-

adding route page:

$router[] = new Route('<presenter>/<action>[/<id>]', array(
    'module' => 'Frontend', // module name
    'presenter' => 'Home', // presenter name
    'action' => 'default', // action name
			'id' => [
        Route::PATTERN => '\d+',
    ],
));

and addding presenter function paramater id sample :

public function renderDefault($id){ // adding $id paramater
}

hsynucak
Member | 8
+
0
-

David Matějka wrote:

Hi, according to the error message, the router is correct. why do you want to “disable template”? you don't want to show html response to a user? or what is an expected response?

hi;
I am having problems with seo url definitions. what I did didn't happen. can you help me.