Re: using smarty for text files

From: Date: Wed, 07 Feb 2001 14:27:20 +0000
Subject: Re: using smarty for text files
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-69@lists.php.net to get a copy of this message
That is an inherent behavior of php. Your tag: {$name} Gets converted to: <?php echo $name; ?> And PHP strips carriage returns. The quick solution is to put a space after the tags { } that need carriage returns. Joris Trooster / Interstroom wrote: > > I used Smarty for creating an text page instead of a html page. > I came across the following behaviour (example): > > template_txt.tpl: > --------------------------------------------------- > Contact: > Name: {$name} > Country: {$country} > > And another line. > --------------------------------------------------- > > template_txt.php: > --------------------------------------------------- > $template->assign("name","Joris Trooster"); > $template->assign("country","Netherlands"); > $template->display("template_txt.tpl"); > --------------------------------------------------- > > The result is the following output: > --------------------------------------------------- > Contact: > Name: Joris TroosterCountry: Netherlands > And another line. > --------------------------------------------------- > > There is no linefeed _after_ the template variables. > The compiled template is: > --------------------------------------------------- > Contact: > Name: <?php print $name; ?> > Country: <?php print $country; ?> > > And another line. > --------------------------------------------------- > > It seems like Smarty is doing the right job, but php is not... > I added an extra space _after_ the variable in the template, but it is > annoying :( > > Regards, > Joris > NL > > --- > You are currently subscribed to smarty as: monte@ispi.net > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/ -- Monte Ohrt <monte@ispi.net> http://www.ispi.net/

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