AloFramework documentation
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo

Namespaces

  • Alo
    • Cache
    • CLI
    • Controller
    • Db
      • Query
    • Exception
    • FileSystem
    • Session
    • Traversables
    • Validators
    • Windows
  • Controller
  • None
  • PHP

Classes

  • Cart
  • Sample
  • SampleErrorController
 1 <?php
 2 
 3     namespace Controller;
 4 
 5     use Alo\Controller\AbstractController;
 6 
 7     if (!defined('GEN_START')) {
 8         http_response_code(404);
 9     } else {
10 
11         /**
12          * A sample controller
13          *
14          * @author Art <a.molcanovas@gmail.com>
15          */
16         class Sample extends AbstractController {
17 
18             /**
19              * Default index page
20              *
21              * @author Art <a.molcanovas@gmail.com>
22              */
23             function index() {
24                 $this->loadView('sample', ['foo' => 'bar']);
25             }
26 
27             /**
28              * Sample method for a more complex route
29              *
30              * @author Art <a.molcanovas@gmail.com>
31              *
32              * @param string $first  The first string to echo
33              * @param string $second The second string to echo
34              */
35             function echoer($first = '[not supplied]', $second = '[not supplied]') {
36                 echo 'Your first param was <span style="font-weight:bold">' . $first . '</span> and your second was ' .
37                      '<span style="font-weight:bold">' . $second . '</span>';
38             }
39 
40             /**
41              * Sample method for when the class parameter isn't supplied.
42              *
43              * @author Art <a.molcanovas@gmail.com>
44              */
45             function noclass() {
46                 echo 'You\'re in the noclass method! Your routed args are <span style="font-weight:bold">' .
47                      implode(',', func_get_args()) . '</span>';
48             }
49 
50             /**
51              * Sample method for the final route test
52              *
53              * @author Art <a.molcanovas@gmail.com>
54              */
55             function noparam() {
56                 echo 'You\'re in the no-param method!';
57             }
58 
59             /**
60              * Sample method for showing parameters
61              *
62              * @author Art <a.molcanovas@gmail.com>
63              */
64             function paramed() {
65                 $vars = func_get_args();
66                 echo 'Your path params are' .
67                      ($vars ? ' <span style="font-weight:bold">' . implode(', ', $vars) . '</span>' : '
68                 ... not set.');
69             }
70         }
71     }
72 
AloFramework documentation API documentation generated byApiGen 2.8.0