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 mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-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!