Example #1
0
File: Qadwa.php Project: 4lb0/qadwa
 /**
  * Singleton
  * 
  * @param array $params Configuration params
  * 
  * @return Qadwa
  */
 public static function getInstance(array $params = array())
 {
     if (!self::$_instance) {
         self::$_instance = new self($params);
     } elseif (count($params)) {
         foreach ($params as $key => $value) {
             self::$_instance->__set($key, $value);
         }
     }
     return self::$_instance;
 }
Example #2
0
File: index.php Project: 4lb0/qadwa
<?php

require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/src/Qadwa.php';
print Qadwa::getInstance(array('baseUrl' => '/examples/03_simplesite/'));
Example #3
0
File: index.php Project: 4lb0/qadwa
<?php

// this is only to show how
Qadwa::getInstance()->redirect('qadwa/show');
Example #4
0
File: index.php Project: 4lb0/qadwa
<?php

// Include the class
require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/src/Qadwa.php';
// Just print the Qadwa instance
print Qadwa::getInstance(array('baseUrl' => '/examples/01_helloworld/'));
Example #5
0
File: index.php Project: 4lb0/qadwa
<?php

require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/src/Qadwa.php';
print Qadwa::getInstance(array('baseUrl' => '/examples/05_controller/'));
Example #6
0
File: index.php Project: 4lb0/qadwa
<?php

require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/src/Qadwa.php';
// This is the same case that the hello world example but now
// you must ensure to have the .htacess and the Apache Rewrite module
print Qadwa::getInstance(array('baseUrl' => '/examples/02_static/'));
Example #7
0
File: index.php Project: 4lb0/qadwa
<?php

session_start();
require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/src/Qadwa.php';
if (!isset($_SESSION['debug'])) {
    $_SESSION['debug'] = 0;
}
print Qadwa::getInstance(array('baseUrl' => '/examples/06_errors/', 'debug' => $_SESSION['debug'], 'error400Template' => 'error/not-found', 'error500Template' => 'error/internal'));
Example #8
0
<?php

// here we check if a POST is received.
if (Qadwa::getInstance()->isPost()) {
    $body = '';
    foreach (array('name', 'email', 'message') as $name) {
        $value = $_POST[$name];
        $body .= "{$name}: {$value}\n";
    }
    // Here fetch the user defined configuration
    // it is in the etc/defaul.ini file
    $contactMail = Qadwa::getInstance()->contact_mail;
    $result = mail($contactMail, 'Contact', $body);
    $message = $result ? 'Form sended ok!' : 'There was an error while sending the form';
} else {
    $message = null;
}
// Set the var to the template
// yes! is a return without any function,
// it terminates the processing in this file
// you can check more info in http://php.net/include
return array('message' => $message);
Example #9
0
File: index.php Project: 4lb0/qadwa
<?php

require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/src/Qadwa.php';
print Qadwa::getInstance(array('baseUrl' => '/examples/04_views/', 'templateFile' => 'templates/%s.html', 'layoutFile' => 'templates/%s.html', 'defaultModule' => 'home', 'layout' => false));