File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+
3+ class IndexController extends Phalcon_Controller {
4+
5+ function indexAction (){
6+
7+ }
8+
9+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ class SignupController extends Phalcon_Controller {
4+
5+ function indexAction (){
6+
7+ }
8+
9+ function registerAction (){
10+
11+ //Request variables from html form
12+ $ name = $ this ->request ->getPost ('name ' , 'string ' );
13+ $ email = $ this ->request ->getPost ('email ' , 'email ' );
14+
15+ $ user = new Users ();
16+ $ user ->name = $ name ;
17+ $ user ->email = $ email ;
18+
19+ //Store and check for errors
20+ if ($ user ->save () == true ) {
21+ echo 'Thanks for register! ' ;
22+ } else {
23+ echo 'Sorry, the next problems was generated: ' ;
24+ foreach ($ user ->getMessages () as $ message ){
25+ echo $ message ->getMessage (), '<br/> ' ;
26+ }
27+ }
28+ }
29+
30+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ class Users extends Phalcon_Model_Base {
4+
5+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ echo "<h1>Hello!</h1> " ;
4+
5+ echo Phalcon_Tag::linkTo ("signup " , "Sign Up Here! " );
6+
Original file line number Diff line number Diff line change 1+ <h2>Sign using this form</h2>
2+
3+ <?php echo Phalcon_Tag::form ('signup/register ' ) ?>
4+
5+ <p>
6+ <label for="name">Name</label>
7+ <?php echo Phalcon_Tag::textField ("name " ) ?>
8+ </p>
9+
10+ <p>
11+ <label for="name">E-Mail</label>
12+ <?php echo Phalcon_Tag::textField ("email " ) ?>
13+ </p>
14+
15+ <p>
16+ <?php echo Phalcon_Tag::submitButton ("Register " ) ?>
17+ </p>
18+
19+ </form>
Original file line number Diff line number Diff line change 1+ AddDefaultCharset UTF-8
2+ <IfModule mod_rewrite.c >
3+ RewriteEngine On
4+ RewriteCond %{REQUEST_FILENAME} !-d
5+ RewriteCond %{REQUEST_FILENAME} !-f
6+ RewriteRule ^(.*)$ index.php?_url=$1 [QSA,L]
7+ </IfModule >
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ try {
4+
5+ $ config = new Phalcon_Config (array (
6+ 'database ' => array (
7+ 'adapter ' => 'Mysql ' ,
8+ 'host ' => 'localhost ' ,
9+ 'username ' => 'test ' ,
10+ 'password ' => 'test ' ,
11+ 'name ' => 'test_db '
12+ ),
13+ 'phalcon ' => array (
14+ 'controllersDir ' => '../app/controllers/ ' ,
15+ 'modelsDir ' => '../app/models/ ' ,
16+ 'viewsDir ' => '../app/views/ '
17+ )
18+ ));
19+
20+ $ front = Phalcon_Controller_Front::getInstance ();
21+ $ front ->setConfig ($ config );
22+ echo $ front ->dispatchLoop ()->getContent ();
23+
24+ }
25+ catch (Phalcon_Exception $ e ){
26+ echo 'PhalconException: ' .$ e ->getMessage (), PHP_EOL ;
27+ }
28+
You can’t perform that action at this time.
0 commit comments