Jump to content

Installing Smarty on WAMP help wanted


kev

Recommended Posts

  • 3 weeks later...

- Download and extract Smarty Folder to your project folder

 

- Create templates, templates_c folder

 

- So you have directories as follows

 

project Folder

- Smarty

- templates

- index.tpl [Create this file and write something in it for testing]

- templates_c

<?php

 

// put full path to Smarty.class.php

require('Smarty/Smarty.class.php');

 

// Create Object

$smarty = new Smarty();

 

$smarty->setTemplateDir('templates');

$smarty->setCompileDir('templates_c');

 

$smarty->display('index.tpl');

?>

Link to comment
Share on other sites

Hello Mahendra.    Thanks for replying.

 

I have actually managed to get that far with the 'basic setup' from... 

http://ubuntu-linux-apache-mysql-php.blogspot.com/2009/10/how-to-install-smarty-with-wampserver.html

 

What I'm now in conflict with is the 'extended setup' described on the same webpage, at the first try it's throwing out an error, but this might be due to using a slightly later version of Smarty than from the webpage, at the moment my version is 3.1.0.

 

My problem is trying to get the concept and path into my head.

 

Have a look at the page and tell me what you think and also how would it be modified for the latest stable Smarty 3.1.7.

 

Kev

Link to comment
Share on other sites

Hello Kev,

 

can give me description or screenshot of the error you get. so i can better understand.

 

And one more thing, about path, you can do this in two way.

 

1.. You can set Smarty class path by modifying php.ini file as done on webpage you have given.

 

include_path = ".;c:\wamp\bin\php\php5.3.0\pear;c:\wamp\bin\php\php5.3.0\Smarty\libs"

 

by doing this you just need to insert line of code like

 

"require_once(SMARTY_DIR . 'Smarty.class.php');"

 

Here SMARTY_DIR is constant, which automatically set by Smarty.

 

2.. second way is what i have done in my previous reply

 

 

In all cases you have  to make path to smarty class file that's it..

 

 

 

Link to comment
Share on other sites

Hello Mahedra.

Thanks form replying.

 

I had already used the setup and code from Jon Lyles blog and it threw out an error, this I corrected (more by accident than design) by removing from the "include_once" the 'SMARTY_DIR .' reference, it all worked fine after that.

 

The interest now, after having success with the 'Basic' setup was to get the 'Extended setup' to function, I think Jon Lyle's code for this particular type of setup needs examining and maybe modifying to suit a newer version of Smarty.  I have attempted to contact Jon Lyle but without success.

 

I am a rank amateur at coding and would be grateful for your help.

 

Kev

Link to comment
Share on other sites

Hello again Mahendra.

I found what amounted to a couple of typo's in my script for using Smarty extended setup and it now almost works.  At a guess I would say this error is due to a problem with some sort of variation with the Smarty version that I am using and the version that Jon Lyle used, here is the error.

 

Fatal error: Uncaught exception 'SmartyException' with message 'Call of unknown function 'Smarty'.' in C:\wamp\bin\php\php5.3.0\Smarty\libs\sysplugins\smarty_internal_templatebase.php:692 Stack trace: #0 [internal function]: Smarty_Internal_TemplateBase->__call('Smarty', Array) #1 C:\wamp\bin\php\php5.3.0\includes\guestbook\setup.php(18): Smarty_GuestBook->Smarty() #2 C:\wamp\www\guestbook\index.php(4): Smarty_GuestBook->Smarty_GuestBook() #3 {main} thrown in C:\wamp\bin\php\php5.3.0\Smarty\libs\sysplugins\smarty_internal_templatebase.php on line 692

 

Thans Kev

Link to comment
Share on other sites

Hello again Mahendra.

 

I had another go at the 'extended setup' I compared Jon Lyles 'setup.php' against Smarty.net 'extended setup'

I had to make one or two alterations and the thing worked first time.

 

That's that sorted now to fix 'PEAR'

 

Kev

Link to comment
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.