RE: [SMARTY] Delimiter problem

From: Date: Fri, 16 Jul 2004 00:21:05 +0000
Subject: RE: [SMARTY] Delimiter problem
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-11605@lists.php.net to get a copy of this message
G'Day Robert, Here they are. Smarty_test.php <?php require_once('smarty-win.php'); // create object //$smarty = new Smarty; // assign some content. This would typically come from // a database or other source, but we'll use static // values for the purpose of this example. $smarty->assign('name', 'John Doe'); $smarty->assign('address', '45th & Harris'); // display it $smarty->display('index2.tpl'); ?> Smarty_win.php <?php //############################################################ //# smarty-winxp.php //# -- Sets up a connection with the Smarty template engine. //# //# Usage: require_once('smarty-winxp.php') in a script. //# //# Author: David Redstone //# Email: David X-AT-X inglesisimo X-DOT-X com //# //############################################################ //###################################################################### //# Create constants to represent Smarty's directory, and my directory //# (Notice that for security, Smarty resides outside //# of Apache's web root, which is 'Apache2\htdocs'.) //###################################################################### //C:\Program Files\Apache Software Foundation\Apache2\smarty define('SMARTY_DIR','c:\\Program Files\\Apache Software Foundation\\Apache2\\smarty\\libs\\'); // Note: You have to 'escape' backslashes, hence: \\ define('MY_DIR','c:\\Program Files\\Apache Software Foundation\\Apache2\\smarty\\gnd\\'); //####################################### //# Use Smarty.class.php in this file. //####################################### require_once(SMARTY_DIR.'Smarty.class.php'); //############################## //# Create a new Smarty object //############################## $smarty = new Smarty; //################################### //# Setup some of Smarty's options. //################################### $smarty->compile_check = true; //$smarty->debugging = true; // Uncomment this if you want to see the debugging window pop up when you call a template! //########################################################### //# Setup the Smarty template engine's directory structure. //# (gnd is my personal project directory!) //########################################################### $smarty->template_dir = MY_DIR.'templates'; $smarty->compile_dir = MY_DIR.'templates_c'; $smarty->config_dir = MY_DIR.'configs'; $smarty->left_demiliter = '<!--{'; $smarty->right_demiliter = '}-->'; ?> *** note delimiters in the .tpl *** Index2.tpl <html> <head> <title>User Info</title> </head> <body> User Information:<p> Name: {$name}<br> Address: {$address}<br> </body> </html> Source of output <html> <head> <title>User Info</title> </head> <body> User Information:<p> Name: John Doe<br> Address: 45th & Harris<br> </body> </html> Changed the delimiters <html> <head> <title>User Info</title> </head> <body> User Information:<p> Name: <!--{$name}--><br> Address: <!--{$address}--><br> </body> </html> Source of output after change <html> <head> <title>User Info</title> </head> <body> User Information:<p> Name: <!--John Doe--><br> Address: <!--45th & Harris--><br> </body> </html> Thanking you for your time, Craig Gaffney PC Applications Developer Rinstrum Pty Ltd (formerly Ranger Instruments) 41 Success St, Acacia Ridge Qld 4110 Australia Ph: +61 7 3216 7166 Fax: +61 7 3216 6211 Email: gaffney@rinstrum.com Web: www.rinstrum.com -----Original Message----- From: Robert Amos [mailto:shiznatz@gmail.com] Sent: Friday, 16 July 2004 10:07 AM To: smarty-general@lists.php.net Subject: Re: [SMARTY] Delimiter problem Do you have a snippet of code that demonstrates this problem, including where you set the delimiters, etc? A quick glance through the 2.6.3 code seems that the delimiters are working correctly for me, and a test change to <!--{ and }--> works fine for me. -bok On Fri, 16 Jul 2004 09:40:41 +1000, Craig Gaffney <gaffney@rinstrum.com> wrote: > G'Day everyone, > I have a problem with delimiters in Smarty 2.6.3. No matter > what I try and put in for my delimiters, the smarty engine only uses > '{' & '}'. > When I try and use my preferred delimiters, '<!--{' & > '}-->', > on display all I get is > > <!-- <substituted value>-->. > > I have confirmed that I am using the proper template file & > location, I am setting the delimiter fields before any assign methods > & display. Smarty is working fine in all other matters. > > Any ideas, suggestions, etc. > > Environment > OS - Win2K SP4 > Web Server - Apache 2.0.50 > PHP Version - 4.3.7 > Smarty Version - 2.6.3 > > Thanking you for your time, > > Craig Gaffney > PC Applications Developer > Rinstrum Pty Ltd (formerly Ranger Instruments) > 41 Success St, Acacia Ridge Qld 4110 Australia > Ph: +61 7 3216 7166 > Fax: +61 7 3216 6211 > Email: gaffney@rinstrum.com > Web: www.rinstrum.com > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __________ NOD32 1.811 (20040715) Information __________ This message was checked by NOD32 antivirus system. http://www.nod32.com

« previous php.smarty.general (#11605) next »