Jump to content

Recommended Posts

I have just installed Smarty on my local server and am trying to get it to work. I have created 4 seperate folders as instructed in Beginning PHp book includes templates, configs, templates_c and cache folders. All these folders are inside the Smarty folder in C:/PHP/includes and the include_path directive is setup.

 

When I try to run the template with the code below:

<?php
require_once("Smarty.class.php");
$smarty = new Smarty;

$smarty->assign("title", "Welcome to your Smarty Page");
$smarty->assign("body", "As you can see, everything is working properly on the template side");

$smarty->display("welcome.tpl");
?>

 

The following error is returned:

 

[25-Jan-2011 03:51:38] PHP Fatal error:  Uncaught exception 'SmartyException' with message 'Unable to load template file 'welcome.tpl'' in

 

I thought it would search by default inside the templates folder however it doesn't. Is there any way to set it manually or what should I do?

 

I have tried

$smarty->template_dir="C:\PHP\includes\smarty\templates"; 

after creating the Smarty class however this does not seem to work either.

 

 

Thank you in advance for the help, please ask any more questions that you require of myself.

 

Regards

 

Link to comment
https://forums.phpfreaks.com/topic/225592-installing-smarty/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.