Skip to content

Commit

Permalink
Merge pull request #1 from phalcon/0.5.0
Browse files Browse the repository at this point in the history
0.5.0
  • Loading branch information
Phalcon committed Sep 17, 2012
2 parents 58368e0 + 132465e commit 18fc00a
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 35 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
.DS_Store
public/.DS_Store
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -15,7 +15,7 @@ Get Started

To run this application on your machine, you need at least:

* PHP >= 5.3.6
* PHP >= 5.3.11
* Apache Web Server with mod rewrite enabled
* Phalcon PHP Framework extension enabled (0.4.x)
* Phalcon PHP Framework extension enabled (0.5.x)

6 changes: 4 additions & 2 deletions app/controllers/IndexController.php
@@ -1,8 +1,10 @@
<?php

class IndexController extends Phalcon_Controller {
class IndexController extends Phalcon\Mvc\Controller
{

function indexAction(){
public function indexAction()
{

}

Expand Down
9 changes: 6 additions & 3 deletions app/controllers/SignupController.php
@@ -1,12 +1,15 @@
<?php

class SignupController extends Phalcon_Controller {
class SignupController extends Phalcon\Mvc\Controller
{

function indexAction(){
public function indexAction()
{

}

function registerAction(){
public function registerAction()
{

//Request variables from html form
$name = $this->request->getPost('name', 'string');
Expand Down
3 changes: 2 additions & 1 deletion app/models/Users.php
@@ -1,5 +1,6 @@
<?php

class Users extends Phalcon_Model_Base {
class Users extends Phalcon\Mvc\Model
{

}
2 changes: 1 addition & 1 deletion app/views/index/index.phtml
Expand Up @@ -2,5 +2,5 @@

echo "<h1>Hello!</h1>";

echo Phalcon_Tag::linkTo("signup", "Sign Up Here!");
echo Phalcon\Tag::linkTo("signup", "Sign Up Here!");

8 changes: 4 additions & 4 deletions app/views/signup/index.phtml
@@ -1,19 +1,19 @@
<h2>Sign using this form</h2>

<?php echo Phalcon_Tag::form('signup/register') ?>
<?php echo Phalcon\Tag::form('signup/register') ?>

<p>
<label for="name">Name</label>
<?php echo Phalcon_Tag::textField("name") ?>
<?php echo Phalcon\Tag::textField("name") ?>
</p>

<p>
<label for="name">E-Mail</label>
<?php echo Phalcon_Tag::textField("email") ?>
<?php echo Phalcon\Tag::textField("email") ?>
</p>

<p>
<?php echo Phalcon_Tag::submitButton("Register") ?>
<?php echo Phalcon\Tag::submitButton("Register") ?>
</p>

</form>
2 changes: 1 addition & 1 deletion public/.htaccess
Expand Up @@ -3,5 +3,5 @@ AddDefaultCharset UTF-8
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?_url=$1 [QSA,L]
RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L]
</IfModule>
55 changes: 34 additions & 21 deletions public/index.php
Expand Up @@ -2,27 +2,40 @@

try {

$config = new Phalcon_Config(array(
'database' => array(
'adapter' => 'Mysql',
'host' => 'localhost',
'username' => 'test',
'password' => 'test',
'name' => 'test_db'
),
'phalcon' => array(
'controllersDir' => '../app/controllers/',
'modelsDir' => '../app/models/',
'viewsDir' => '../app/views/'
)
));
//Register an autoloader
$loader = new \Phalcon\Loader();
$loader->registerDirs(
array(
'../app/controllers/',
'../app/models/'
)
)->register();

$front = Phalcon_Controller_Front::getInstance();
$front->setConfig($config);
echo $front->dispatchLoop()->getContent();
//Create a DI
$di = new Phalcon\DI\FactoryDefault();

}
catch(Phalcon_Exception $e){
echo 'PhalconException: '.$e->getMessage(), PHP_EOL;
}
//Set the database service
$di->set('db', function(){
return new \Phalcon\Db\Adapter\Pdo\Mysql(array(
"host" => "localhost",
"username" => "root",
"password" => "secret",
"dbname" => "test_db"
));
});

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

//Handle the request
$application = new \Phalcon\Mvc\Application();
$application->setDI($di);
echo $application->handle()->getContent();

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

0 comments on commit 18fc00a

Please sign in to comment.