codeguy/Slim — Issue #201: Using subclasses with SLIM
Author: cept0
Created: 2011-12-27 09:23:38+00:00
State: open

How can I access Subclasses with SLIM ?

I want to do somethingh like this, to size down my index.php and make it some "bits" smarter:

```SlimOutput..php

class SlimOutput {
protected $app;
protected $settings;

public function __construct( $app, $settings = array() ) {
$this->app = $app;
$this->settings = $settings;
}

public function myalias( $name ) {

return $name.' shady';
}
}```

```index.php
require 'Slim/Slim.php';
require 'SlimOutput.php';

$app = new Slim(array(
'output' => 'SlimOutput',
));

if($app->request()->isGet())
{
print_r($app->output->myalias('slim')); //returns: "slim shady"
}

$app->run();```

This seems not to work. SLIM returns, that $output is not defined. What's wrong?