Re: using smarty for text files

From: Date: Wed, 07 Feb 2001 14:36:49 +0000
Subject: Re: using smarty for text files
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-70@lists.php.net to get a copy of this message
If you don't like putting a space after your tags, you could write a custom function that prints a newline: function smarty_func_newline { echo "\n"; } Name: {$name}{newline} Maybe we'll add this to smarty by default. Thoughts? 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 (#70) next »