[Cartoweb-users] Troubles using Smarty

Alexandre Saunier alexandre.saunier at camptocamp.com
Fri Jan 13 10:40:56 EST 2006


Hello,

You have nothing to install or compile and you don't need to make PHP 
files of your own. Simply edit your templates (.tpl files in templates/ 
directories) and reload your browser. If the template cache is on, you 
may have to launch a
php cw3setup.php --clean
in a command line prompt to refresh the cache.

Note that if you want to make a project of your own it is not 
recommended to modify the demoCW3 project (keep it as an example). 
Oliver wrote a tutorial about how to make a new project based on demoCW3:
http://cartoweb.org/cwiki/HowToCreateANewProject

Projects are explained in the manual here:
http://cartoweb.org/doc/cw3.1/xhtml/user.project.html
and templating tips are available here:
http://cartoweb.org/doc/cw3.1/xhtml/user.template.html

If your not familiar with Smarty, have a look at the Smarty manual:
http://smarty.php.net/manual/it/

AS

Valerio Noti a écrit :
> Oliver and Marc,
> thanks for reply. I'm very confused about to compile these tpl files and 
> I'm not a php expert...
> Now I added to php.ini an include_path to C:\wamp\www\cartoweb3\include 
> where smarty folder is located.
> If I want to recompile i.e. 
> C:/wamp/www/cartoweb3/projects/demoCW3/templates/cartoclient.tpl which 
> php file have I to use?
> Do I have to include Smarty_Cartoclient.php in a MyFile.php and there 
> use a command like
> 
> $smarty->display('cartoclient.tpl');
> 
> ?
> 
> 
> Thanks again
> 
> Valerio Noti
> 
> 
> 
> 
> /*
> Valerio Noti
> valerionoti at yahoo.it
> */
> ----- Original Message ----- From: "oliver" 
> <oliver.christen at camptocamp.com>
> To: <cartoweb-users at lists.maptools.org>; "Valerio Noti" 
> <valerionoti at yahoo.it>
> Sent: Friday, January 13, 2006 3:34 PM
> Subject: Re: [Cartoweb-users] Troubles using Smarty
> 
> 
>> Cartoweb overload some Smarty class, several tag are defined, such as
>> {r}..{/r} {t}...{/t} and also a plugin allowing recursive treatments
>> (fun/defun) is used, which are not in the standart Smarty package.
>> You can find all necessary files in the "include" package on cartoweb's
>> download page: cartoweb-includes-3.1.0.zip or 
>> cartoweb-includes-3.1.0.tar.gz
>> (http://www.cartoweb.org/downloads.html)
>>
>> Your error seems to come from the fact you bypass the call to the smarty
>> engine in Cartoweb, trying to use a direct instance of Smarty instead of
>> Smarty_Cartoclient
>>
>> see the file cartoweb3/client/Smarty_Cartoclient.php for more details
>>
>> Oliver
>>
>>> Hi,
>>> I'm trying to modify layout of CW3Demo project. I never used Smarty 
>>> and I
>>> have problems using (configuring?) it..
>>>
>>> These are the steps I followed:
>>>
>>> 1) Downloaded Smarty 2.6.11.
>>> 2) Followed instructions for Windows installation
>>> (http://news.php.net/php.smarty.dev/2703 )
>>> 3) Tested the sample code of that page. It works.
>>> 4) Modified (just changed a static string) in
>>> C:/wamp/www/cartoweb3/projects/demoCW3/templates/cartoclient.tpl (is 
>>> this
>>
>> a
>>
>>> right file?)
>>> 5) Created index.php with the following code:
>>>
>>> <?php
>>> // load Smarty library
>>> require('Smarty.class.php');
>>> $smarty = new Smarty;
>>> $smarty->template_dir =
>>
>> 'C:/wamp/www/cartoweb3/projects/demoCW3/templates';
>>
>>> $smarty->config_dir = 'C:\wamp\www\smarty\configs';
>>> $smarty->cache_dir = 'C:\wamp\smarty\cache';
>>> $smarty->compile_dir = 'C:\wamp\www\cartoweb3\templates_c';
>>>
>>> //$smarty->assign('name','fish boy!');
>>> $smarty->display('cartoclient.tpl');
>>> ?>
>>>
>>> 6) When I execute index.php the error it gives me is:
>>>
>>> Fatal error: Smarty error: [in cartoclient.tpl line 7]: syntax error:
>>> unrecognized tag 'r' (Smarty_Compiler.class.php, line 580) in
>>> c:\wamp\smarty\libs\Smarty.class.php on line 1095
>>>
>>> If I understood how this tool works, when I execute this index.php file,
>>> Smarty trasforms tpl in php file e saves it in
>>> C:\wamp\www\cartoweb3\templates_c (compile_dir).
>>> So the Cartoweb demo would be updated. Is this correct?
>>>
>>> Any help appreciated
>>> thanks
>>>
>>> Valerio Noti
>>>
>>> _______________________________________________
>>> Cartoweb-users mailing list
>>> Cartoweb-users at lists.maptools.org
>>> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>>>
>>
>>
>>
>> -- 
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.1.371 / Virus Database: 267.14.17/228 - Release Date: 
>> 12/01/2006
>>
>>
> 
> _______________________________________________
> Cartoweb-users mailing list
> Cartoweb-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/cartoweb-users


More information about the Cartoweb-users mailing list