Nette 2.1.0, Quickstart, href

Notice: This thread is very old.
tzang
Member | 4
+
0
-

Hi, guys,

While following the tutorial quickstart, I've met an unexpected problem which I can't solve for hours

  1. default.latte

    <h2><a n:href=“Post:show $post->id”>{$post->title}</a></h2>

  2. PostPresenter.php

    class PostPresenter extends BasePresenter

    {
    private $database;

    public function __construct(Nette\Database\Context $database)
    {
    $this->database = $database;
     }

    public function renderShow($postId)
    {
    $this->template->post = $this->database->table(‘posts’)->get($postId);
    if (!$post) {
    $this->error(‘Post not found’);
     }

    $this->template->post = $post;
    }

    }

  3. linked url

    http://localhost/nette-blog/www/post/show?postId=5

  4. result when clicked

    The requested URL /nette-blog/www/post/show was not found on this server.

Could someone tell me a way to get out of this?

Thanks in advance

Last edited by tzang (2014-01-16 18:00)

screenas
Member | 5
+
0
-

Hi,

do you have mod_rewrite enabled?

tzang
Member | 4
+
0
-

Hi, screenas

I don't think I have mod_rewrite enabled

There is nothing on that in the tutorial

Can I do that in app\.htaccess or in other place?

thanks

tzang
Member | 4
+
0
-

Yeah
You're right

I just turned on the mod_rewrite in httpd.conf of apache, then the linking problem got solved

Thanks a lot for the hint

screenas
Member | 5
+
0
-

Use Nette requirements checker
in case that mod_rewrite is not enabled, open and edit your httpd.conf file.

uncomment:
#LoadModule rewrite_module...
to
LoadModule rewrite_module...

tzang
Member | 4
+
0
-

Thank you for your concern, screenas

You saved me several more hours and worries

screenas
Member | 5
+
0
-

you are welcome