Re: [Phplib-users] Templates -- lists vs. rows
Brought to you by:
nhruby,
richardarcher
|
From: Fred Y. <fc...@ac...> - 2002-11-05 21:39:23
|
On Tue, Nov 05, 2002 at 02:53:18PM -0500, Matthew Leingang wrote:
> But what if instead of a list I want this?
>
> [ <a href="url1">text1</a> | <a href="url2">text2</a> | ... |
> <a href="urln">textn</a> ]
I tend to use this idiom when generating separators:
$sep = '';
foreach ($links as $url => $text) {
$template->set_var('SEP', $sep);
$template->set_var('URL',$url);
$template->set_var('TEXT',$text);
$template->parse('links', 'each_link', true);
$sep = '|';
}
where the template looks like this:
[
<!-- BEGIN each_link -->
{SEP} <a href="{URL}">{TEXT}</a>
<!-- END each_link -->
]
--
Fred Yankowski fr...@on... tel: +1.630.879.1312
OntoSys, Inc PGP keyID: 7B449345 fax: +1.630.879.1370
www.ontosys.com 38W242 Deerpath Rd, Batavia, IL 60510-9461, USA
|