lundi 24 avril 2017

Hyperlink buttons not working

This is my home page. Nothing much, just 3 tags that redirect to different pages. Code :

<div>
<h1> Welcome to my YeePHP project</h1>
<h1> Click <a href=" register "> here </a> to register</h1>
<h1> Click <a href=" login "> here </a> to login</h1>
<h1> Click <a href=" dashboard "> here </a> to enter the dashboard</h1>

This is my DashboardController :

class DashboardController extends \Yee\Managers\Controller\Controller

{

/**
 * @Route('/dashboard')
 * @Name('dashboard.index')
 */
public function index()
{
    $app = $this->getYee();
    $app->render('dashboard/dashboard.twig', $data = array(

    ));
}

/**
 * @Route('/dashboard')
 * @Name('dashboard.post')
 * @Method('POST')
 */

public function post()
{
    $app = $this->getYee();

    $name = $app->request->post('name');
    $comment = $app->request->post('comment');

    $AddCommentModel = new AddCommentModel($name, $comment);

    if($AddCommentModel->comment() == true)
    {
        $AddCommentModel->insertCommentsInDb();
        $app->render('dashboard/dashboard.twig', $data = array());
    }
    else
    {
        $data = array(
            "error"
            );
    }

}   

}

I know what you are thinking. Putting a "/" in the h1 tags. Tried that already but it doesn't work, sadly. What I've noticed is that if i change @Route('/dashboard') to @Route('/(dashboard)') it loads my dashboard page.




Aucun commentaire:

Enregistrer un commentaire