Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Building Websites with PHP Slim Basics & Twig Templates Layouts with Twig

Rohit Poonia
PLUS
Rohit Poonia
Courses Plus Student 1,698 Points

Got some another error of RuntimeException

Slim Application Error

The application could not run because of the following error: Details Type: RuntimeException Message: Cannot set the Smarty lib directory : . Directory does not exist. File: R:\xampp\htdocs\treehouse\vendor\slim\views\Smarty.php Line: 104 Trace

0 R:\xampp\htdocs\treehouse\vendor\slim\views\Smarty.php(87): Slim\Views\Smarty->getInstance()

1 R:\xampp\htdocs\treehouse\vendor\slim\slim\Slim\View.php(255): Slim\Views\Smarty->render('about.twig', NULL)

2 R:\xampp\htdocs\treehouse\vendor\slim\slim\Slim\View.php(243): Slim\View->fetch('about.twig', NULL)

3 R:\xampp\htdocs\treehouse\vendor\slim\slim\Slim\Slim.php(757): Slim\View->display('about.twig')

4 R:\xampp\htdocs\treehouse\index.php(35): Slim\Slim->render('about.twig')

5 [internal function]: {closure}()

6 R:\xampp\htdocs\treehouse\vendor\slim\slim\Slim\Route.php(468): call_user_func_array(Object(Closure), Array)

7 R:\xampp\htdocs\treehouse\vendor\slim\slim\Slim\Slim.php(1357): Slim\Route->dispatch()

8 R:\xampp\htdocs\treehouse\vendor\slim\slim\Slim\Middleware\Flash.php(85): Slim\Slim->call()

9 R:\xampp\htdocs\treehouse\vendor\slim\slim\Slim\Middleware\MethodOverride.php(92): Slim\Middleware\Flash->call()

10 R:\xampp\htdocs\treehouse\vendor\slim\slim\Slim\Middleware\PrettyExceptions.php(67): Slim\Middleware\MethodOverride->call()

11 R:\xampp\htdocs\treehouse\vendor\slim\slim\Slim\Slim.php(1302): Slim\Middleware\PrettyExceptions->call()

12 R:\xampp\htdocs\treehouse\index.php(39): Slim\Slim->run()

13 {main}

3 Answers

Do you have an example of the code where the library is being called? The "Directory does not exist" issue to me indicates that the path to that library might not be correct.

Rohit Poonia
Rohit Poonia
Courses Plus Student 1,698 Points

Hello Luke,

Thanks for quick response.

Here is the screenshot : http://prntscr.com/8tqjw0

http://prntscr.com/8tqjw0 please remove #13 from behind this .. i do not know why this is automatically added when i paste the link in here.

Best Regards, Rohit

I can't say I'm too familiar with using Smarty and Slim together but I was able to find someone who set up something similar so maybe looking at their source can help some?

http://help.slimframework.com/discussions/problems/48-using-smarty-with-slim

What was the solution?

Rohit Poonia
PLUS
Rohit Poonia
Courses Plus Student 1,698 Points

$app = new \Slim\Slim(array( 'view' => new \Slim\Views\Twig() //use Twig not Smarty :: Be Careful ));

I used 'view' => new \Slim\Views\Smarty() in place of Twig and interpreter searches for Smarty but not Twig...