For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > July 2004 > Re: [SMARTY] Delimiter problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [SMARTY] Delimiter problem
Robert Amos

2004-07-15, 9:01 pm

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
>
>

Craig Gaffney

2004-07-15, 9:01 pm

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
Jochem Maas

2004-07-15, 9:01 pm

Craig - typo!

> $smarty->left_demiliter = '<!--{';
> $smarty->right_demiliter = '}-->';


whats a 'demiliter'? i think that should be 'delimiter'!

hope that does it.

rgds,

jochem.

Craig Gaffney wrote:

> G'Day Robert,
> Here they are.
>
> Smarty_test.php
> <?php


<snip>
Craig Gaffney

2004-07-16, 3:57 am

G'Day Jochem,
Thank you. I have been staring at this for three days now, and
never saw it until you pointed it out.
Fixed the typo, and now it works!


Thanks for the help,

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: Jochem Maas [mailto:jochem@iamjochem.com]
Sent: Friday, 16 July 2004 10:54 AM
To: gaffney@rinstrum.com
Cc: smarty-general@lists.php.net
Subject: Re: [SMARTY] Delimiter problem


Craig - typo!

> $smarty->left_demiliter = '<!--{';
> $smarty->right_demiliter = '}-->';


whats a 'demiliter'? i think that should be 'delimiter'!

hope that does it.

rgds,

jochem.

Craig Gaffney wrote:

> G'Day Robert,
> Here they are.
>
> Smarty_test.php
> <?php


<snip>


__________ NOD32 1.811 (20040715) Information __________

This message was checked by NOD32 antivirus system. http://www.nod32.com
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com