This file contains hidden or 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 | |
namespace Helloworld\Form; | |
use Zend\Form\Form; | |
class SignUp extends Form | |
{ | |
public function __construct() | |
{ | |
parent::__construct('signUp'); |
This file contains hidden or 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 | |
namespace Helloworld\Form; | |
use Zend\Form\Fieldset; | |
class UserAddressFieldset extends Fieldset | |
{ | |
public function __construct() | |
{ | |
parent::__construct('userAddress'); |
This file contains hidden or 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 | |
namespace Helloworld\Controller; | |
use Zend\Mvc\Controller\AbstractActionController; | |
use Zend\View\Model\ViewModel; | |
class IndexController extends AbstractActionController | |
{ | |
public function indexAction() |
This file contains hidden or 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
return array ( | |
'Doctrine' => array ( | |
'Connection' => array ( | |
'Orm_ default ' => array ( | |
'DriverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver' , | |
'Params' => array ( | |
'Host' => 'localhost' , | |
'Port' => '3306 ' , | |
'User' => 'root' , | |
'Password' => '' , |
This file contains hidden or 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
// BookList/Module.php (a custom ZF2 module) | |
public function onBootstrap(MvcEvent $e) | |
{ | |
$translator = $e->getApplication()->getServiceManager()->get('translator') ; | |
$translator->setLocale(\Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE'])) | |
->setFallbackLocale('en_US') ; | |
} |
This file contains hidden or 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
protected function _initRouter() | |
{ | |
$frontController = Zend_Controller_Front::getInstance(); | |
$router = $frontController->getRouter(); | |
// Product view route | |
$route = new Zend_Controller_Router_Route( | |
'/home', | |
array( | |
'controller' => 'index', |
This file contains hidden or 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
English, US (en_US) | |
German, Germany (de_DE) | |
Chinese, PRC (zh_CN) | |
Chinese, Taiwan (zh_TW) | |
Czech, Czech Republic (cs_CZ) | |
Dutch, Belgium (nl_BE) | |
Dutch, Netherlands (nl_NL) | |
English, Australia (en_AU) | |
English, Britain (en_GB) | |
English, Canada (en_CA) |
This file contains hidden or 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
/*** nullify any existing autoloads ***/ | |
spl_autoload_register(null, false); | |
/*** specify extensions that may be loaded ***/ | |
spl_autoload_extensions('.php'); | |
/*** class Loader ***/ | |
function classLoader($class) | |
{ | |
//$filename = ucfirst(strtolower($class) . '.php') ; |
This file contains hidden or 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
$numbers = array(22, 60, 876, 95, 77); | |
// Initializing the Iterator | |
$iterator = new ArrayIterator($numbers); | |
// Pass the converted array to the LimitIterator | |
$limiter = new LimitIterator($iterator, 0 , 4); | |
// Loop through the LimitIterator object | |
foreach ($limiter as $number) { |
This file contains hidden or 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 | |
/** | |
* SplClassLoader implementation that implements the technical interoperability | |
* standards for PHP 5.3 namespaces and class names. | |
* | |
* http://groups.google.com/group/php-standards/web/final-proposal | |
* | |
* // Example which loads classes for the Doctrine Common package in the | |
* // Doctrine\Common namespace. |