Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Having problem at first phalcon tutorial!

Hello, I'm having issues with the first tutorial in phalcon. I am using apache server on windows at localhost. I installed it as a standalone and not part of a stack like XAMPP or WAMP. I had to do that to enable the mySQL connector for use with c++. I've enabled rewrite, I'm checked my .htaccess files and done pretty much whats been said in this forum. I've no idea why i cannot seem to load my signup page. I always get localhost/public/signup not found error. Below are my codes.

TESTAAR.htaccess

<IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ public/ [L] RewriteRule ((?s).*) public/$1 [L] </IfModule>

TESTAAR/public/.htaccess

<IfModule modrewrite.c> RewriteEngine On RewriteCond %{REQUESTFILENAME} !-d RewriteCond %{REQUESTFILENAME} !-f RewriteRule ^((?s).*)$ index.php?url=/$1 [QSA,L] </IfModule>

TESTAAR/public.index.php

<?php /** * Created by PhpStorm. * User: User * Date: 18/11/2015 * Time: 4:19 PM */

use Phalcon\Loader; use Phalcon\Mvc\View; use Phalcon\Mvc\Application; use Phalcon\DI\FactoryDefault; use Phalcon\Mvc\Url as UrlProvider; use Phalcon\Db\Adapter\Pdo\Mysql as DbAdaptor;

try { // Register an autoloader $loader = new Loader(); $loader->registerDirs(array( '../app/controllers/', '../app/models/' ))->register();

//Create a DI
$di = new FactoryDefault();

// Set up the view component
$di->set('view', function() {
    $view = new View();
    $view->setViewsDir('../app/views/');
    return $view;
});

//Setup a base URI so tha all generated URIs include the "tutorial folder
$di->set('url', function() {
    $url = new UrlProvider();
    $url->getBaseUri('/TESTAAR/');
    return $url;
});

// Handle the request
$application = new Application($di);

echo $application->handle()->getContent();

} catch (\Exception $e) { echo "PhalconException: ", $e->getMessage(); }

TESTAAR/app/controllers/IndexController.php

<?php /** * Created by PhpStorm. * User: User * Date: 19/11/2015 * Time: 10:44 AM */ use Phalcon\Mvc\Controller;

class IndexController extends Controller { public function indexAction() { } }

TESTAAR/app/views/index/index.phtml

<?php /** * Created by PhpStorm. * User: User * Date: 19/11/2015 * Time: 10:46 AM */ echo "<h1>Hello!</h1>";

echo $this->tag->linkTo("signup", "Sign Up Here!");

TESTAAR/app/controllers/SignupController.php

<?php /** * Created by PhpStorm. * User: User * Date: 19/11/2015 * Time: 10:48 AM */

use Phalcon\Mvc\Controller;

class SignupController extends Controller { public function indexAction() {

}

}

TESTAAR/app/views/signup/index.phtml

/** * Created by PhpStorm. * User: User * Date: 19/11/2015 * Time: 10:50 AM */ <h2>Sign up using this form</h2>

<?php echo $this->tag->form("signup/register"); ?>

<p> <label for="name">Name</label> <?php echo $this->tag->textField("name") ?> </p>

<p> <label for="email">Email</label> <?php echo $this->tag->textField("email") ?> </p>

<p> <?php echo $this->tag->submitButton("Register") ?> </p>

</form>

ITS VERY FRUSTRATING TO NOT BBE ABLE TO MAKE IT WORK FOR 5 DAYS!

when i access the url "localhost/TESTAAR/signup" it shows the page perfectly, but the button doesnt work? i believe its a redirect problem. any help will be much appreciated.



64.1k
Accepted
answer

well your form action is

echo $this->tag->form("signup/register");

which i guess shoudl redirect you to localhost/TESTAAR/signup/register.

While in your SignupController you dont have registerAction you have indexAction

perhaps this is wrong ?

Actually, i was something to do with my virtual host creation. So sorry for the trouble.