This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$router = new Phalcon\Mvc\Router(false); | |
$router->add('/raw/brand/{brand}', array( | |
'module' => 'raw', | |
'controller' => 'brand', | |
'action' => 'index' | |
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Registering a dispatcher | |
$di->set('dispatcher', function() { | |
$dispatcher = new \Phalcon\Mvc\Dispatcher(); | |
$dispatcher->setDefaultNamespace('MooK\Controllers'); | |
return $dispatcher; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% if session.has("auth") %} | |
{{ link_to("users/logout", "Log Out") }} | |
{% else %} | |
{{ link_to("users/login", "Log In") }} | |
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Phalcon\Forms\Element\Password, | |
Phalcon\Validation\Validator\PresenceOf, | |
Phalcon\Validation\Validator\StringLength, | |
Phalcon\Validation\Validator\Confirmation; | |
class MyForm extends Phalcon\Forms\Form | |
{ | |
public function initialize() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
trait StaticInjectable | |
{ | |
public function getDI() | |
{ | |
return Phalcon\DI::getDefault(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<table> | |
{% for user in users %} | |
<tr> | |
<td> {{ user.id }} </td> | |
<td> {{ user.username }} </td> | |
</tr> | |
{% endfor %} | |
</table> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{%- macro fibonnaci(n) %} | |
{%- if n == 0 %} | |
{%- return 0 %} | |
{%- elseif n == 1 %} | |
{%- return 1 %} | |
{%- else %} | |
{%- return fibonnaci(n - 1) + fibonnaci(n - 2) %} | |
{%- endif %} | |
{%- endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{%- macro fibonnaci(n) %} | |
{%- if n == 0 %} | |
{%- return 0 %} | |
{%- elseif n == 1 %} | |
{%- return 1 %} | |
{%- else %} | |
{%- return fibonnaci(n - 1) + fibonnaci(n - 2) %} | |
{%- endif %} | |
{%- endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Phalcon\DI, | |
Phalcon\Events\Manager as EventsManager, | |
Phalcon\Db\Adapter\Pdo\Mysql as Connection, | |
Phalcon\Mvc\Model\Manager as ModelsManager, | |
Phalcon\Mvc\Model\Metadata\Memory as ModelsMetaData; | |
$eventsManager = new EventsManager(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class IndexController | |
{ | |
public function indexAction() | |
{ | |
echo '<h2>Running ' . __METHOD__ . '</h2>'; | |
} | |
} |