0
votes
<?php
class  IndexController extends \Phalcon\Mvc\Controller {
    public function indexAction(){

    }
}
?>
<?php
class SignupController extends \Phalcon\Mvc\Controller {
    public function indexAction(){

    }
}
?>
<?php 
    echo "<h1>Hello!</h1>"; 
    echo Phalcon\Tag::linkTo( "signup", "Sign Up Here!");

?>
<?php use Phalcon\Tag; ?>

<h2>Sign up using this form</h2>
<?php echo Tag::form( "signup/register" ); ?>

    <p>
        <label for="name">Name</label>
        <?php echo Tag::textfield( "name" ); ?>
    </p>
    <p>
        <label for="email">E-Mail</label>
        <?php Tag::textfield( "email" ); ?>
    </p>
    <p>
        <?php echo Tag::submitButton( "Register" ); ?>
    </p>
</form>

I was following a tutorial on phalcon framework here but it can't get it to work. I have created the controllers for the index page and the signup page. I also created the views for the index controller and the view for the signup controller.

What happens is that when I click on the link to go to the signup page it shows the url correct which means we should be on the signup page but it shows the index view not the signup view. Basically when i click on the signup link the only thing that changes in the browser is the url but not the page.

anyone know what is going on here?

1
Please supply some code - Ronni Skansing
From index.php, what does echo $_GET['url']; return in the browser when you are viewing the /signup page? - Ultimater
Awesome way to debug. Are all of the above code lines in the same file? Also, post your index.php dispatcher and views di objects. Might as well pastebin your index.php or phalcon bootstrapper. - Justin E

1 Answers

1
votes

Ok,

I got this working in the end.

Make sure that (in my case Nginx) you confirm that it has been set up correctly.

The second thing to look at is the code to handle the request. I have used this: $application = new \Phalcon\Mvc\Application(); $application->setDI($di);

if (!empty($_SERVER['REQUEST_URI'])) {
    $pathInfo = $_SERVER['REQUEST_URI'];
} else {
    $pathInfo = '/';
}
echo $application->handle($pathInfo)->getContent();

This isn't exactly what I wanted, but for some reason my PATH_INFO was coming out as empty, even when I have set cgi.fix_pathinfo to 1 in the php.ini

Hope this helps.