Skip to content

Commit 10220a5

Browse files
committed
Updated the README files to follow the new initialization of a Slim application
1 parent 000e2c9 commit 10220a5

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

README.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ To learn how to write your own custom View class, visit the [Slim Framework docu
3535
require_once 'SmartyView.php';
3636

3737
//Init Slim app with the custom View
38-
Slim::init(array(
38+
$app = new Slim(array(
3939
'view' => new SmartyView()
4040
));
4141

@@ -57,4 +57,4 @@ Slim is in active development, and test coverage is continually improving.
5757

5858
The Slim Framework for PHP 5 and the additional resources in this repository are released under the MIT public license.
5959

60-
<http://www.slimframework.com/license>
60+
<http://www.slimframework.com/license>

Views/README.markdown

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@ The Slim Framework provides a default View class that uses PHP template files by
44

55
## TwigView
66

7-
The `TwigView` custom View class provides support for the [Twig](http://www.twig-project.org/) template library. You can use the TwigView custom View in your Slim application like this:
7+
The `TwigView` custom View class provides support for the [Twig](http://twig.sensiolabs.org/) template library. You can use the TwigView custom View in your Slim application like this:
88

99
<?php
1010
require 'slim/Slim.php';
1111
require 'views/TwigView.php';
12-
Slim::init('TwigView');
12+
$app = new Slim(array(
13+
'view' => 'TwigView'
14+
));
1315
//Insert your application routes here
14-
Slim::run();
16+
$app->run();
1517
?>
1618

1719
You will need to configure the `TwigView::$twigOptions` and `TwigView::$twigDirectory` class variables before using the TwigView class in your application. These variables can be found at the top of the `views/TwigView.php` class definition.
@@ -24,9 +26,11 @@ The `MustacheView` custom View class provides support for the [Mustache template
2426
require 'slim/Slim.php';
2527
require 'views/MustacheView.php';
2628
MustacheView::$mustacheDirectory = 'path/to/mustacheDirectory/';
27-
Slim::init('MustacheView');
29+
$app = new Slim(array(
30+
'view' => 'MustacheView'
31+
));
2832
//Insert your application routes here
29-
Slim::run();
33+
$app->run();
3034
?>
3135

3236
Before you can use the MustacheView class, you will need to set `MustacheView::$mustacheDirectory`. This property should be the relative or absolute path to the directory containing the `Mustache.php` library.
@@ -38,9 +42,11 @@ The `SmartyView` custom View class provides support for the [Smarty](http://www.
3842
<?php
3943
require 'slim/Slim.php';
4044
require 'views/SmartyView.php';
41-
Slim::init('SmartyView');
45+
$app = new Slim(array(
46+
'view' => 'SmartyView'
47+
));
4248
//Insert your application routes here
43-
Slim::run();
49+
$app->run();
4450
?>
4551

4652
You will need to configure the `SmartyView::$smartyDirectory`, `SmartyView::$smartyCompileDirectory` , `SmartyView::$smartyCacheDirectory` and optionally `SmartyView::$smartyTemplatesDirectory`, class variables before using the SmartyView class in your application. These variables can be found at the top of the `views/SmartyView.php` class definition.
@@ -52,11 +58,13 @@ The `BlitzView` custom View class provides support for the Blitz templating syst
5258
<?php
5359
require 'slim/Slim.php';
5460
require 'views/BlitzView.php';
55-
Slim::init('BlitzView');
61+
$app = new Slim(array(
62+
'view' => 'BlitzView'
63+
));
5664
//Insert your application routes here
57-
Slim::run();
65+
$app->run();
5866
?>
59-
67+
6068
Place your Blitz template files in the designated templates directory.
6169

6270
## HaangaView
@@ -66,9 +74,9 @@ The `HaangaView` custom View class provides support for the Haanga templating sy
6674
<?php
6775
require 'slim/Slim.php';
6876
require_once 'views/HaangaView.php';
69-
Slim::init(array(
77+
$app = new Slim(array(
7078
'view' => new HaangaView('/path/to/Haanga/dir', '/path/to/templates/dir', '/path/to/compiled/dir')
7179
));
7280
//Insert your application routes here
73-
Slim::run();
74-
?>
81+
$app->run();
82+
?>

0 commit comments

Comments
 (0)