I've got the following array I want to pass to smarty:
a apple
a artichoke
b banana
I want the output to look like:
a 2 items
apple
articoke
b 1 item
banana
Is there an easy way to do this inside of the template?
Thanks!
rwc 5 2333
rwc wrote: I've got the following array I want to pass to smarty: a apple a artichoke b banana
I want the output to look like: a 2 items apple articoke
b 1 item banana
Is there an easy way to do this inside of the template?
umm... I think I'm reading this wrong. Are you saying that your array is
like this: ???
array (
'a' => 'apple',
'a' => 'artichoke',
'b' => 'banana'
};
or like this:
array (
0 => 'a apple',
1 => 'a artichoke',
2 => 'b banana'
};
--
Justin Koivisto - sp**@koivi.com http://www.koivi.com
array (
'a' => 'apple',
'a' => 'artichoke',
'b' => 'banana'
};
"Justin Koivisto" <sp**@koivi.com> wrote in message
news:Bj*****************@news7.onvoy.net... rwc wrote:
I've got the following array I want to pass to smarty: a apple a artichoke b banana
I want the output to look like: a 2 items apple articoke
b 1 item banana
Is there an easy way to do this inside of the template?
umm... I think I'm reading this wrong. Are you saying that your array is like this: ???
array ( 'a' => 'apple', 'a' => 'artichoke', 'b' => 'banana' };
or like this:
array ( 0 => 'a apple', 1 => 'a artichoke', 2 => 'b banana' };
-- Justin Koivisto - sp**@koivi.com http://www.koivi.com
On Thu, 26 Aug 2004 19:13:54 GMT, "rwc" <rw**@digink.com> wrote: array ( 'a' => 'apple', 'a' => 'artichoke', 'b' => 'banana' };
That array only has two elements - artichoke stomps apple.
<pre>
<?php
var_dump(array (
'a' => 'apple',
'a' => 'artichoke',
'b' => 'banana'
));
?>
array(2) {
["a"]=>
string(9) "artichoke"
["b"]=>
string(6) "banana"
}
--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
rwc wrote: array ( 'a' => 'apple', 'a' => 'artichoke', 'b' => 'banana' };
That can't be done...
<?php
$test= array (
'a' => 'apple',
'a' => 'artichoke',
'b' => 'banana'
);
print_r($test);
?>
Results in:
Array
(
[a] => artichoke
[b] => banana
)
--
Justin Koivisto - sp**@koivi.com http://www.koivi.com
"rwc" <rw**@digink.com> wrote in message news:<%aqXc.20159$oD2.7166@trndny08>... I've got the following array I want to pass to smarty:
<snip>
FWIW, <http://www.google.com/search?q=%22Templates+are+dead+Long+live+PHP%22>
--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Brian |
last post by:
Hello,
I am trying to work out how to have smarty use a string's contents as the
display-> template..
ie:
$smarty->display($buffer);
obviously $buffer isn't a filename, but a smarty template...
|
by: Daan |
last post by:
Hello all,
I'm having a little problem with Smarty. Getting it to work in a simple
case went fine, but now I have the following situation:
/
/smarty
/templates
template.tpl
/templates_c
|
by: Richard |
last post by:
I need help. I have a smarty based program that I am modifying. I
have a smarty template file that consists of smarty and HTML.
I need to integrate some PHP database calls into it. My problem...
|
by: Freebird |
last post by:
Hello you all, =]
I've a smarty var, like this:
{$var}
that is equal to: ttttttttttttt|zzzzzzzzzzzz
It can be any size, the important is that they are separated by the '|'
How do I...
|
by: Conrad |
last post by:
Hi, I'm very new to Smarty Template Engine and I'm using PHP 5.0.4 on
the Windows XP Professional platform and I have the following question:
When I change the 7th line of the script to use a...
|
by: pek |
last post by:
OK, I'm really new in this Template Engine..
I can't figure out how to structure my templates..
Here is what I'm trying to figure out..
Let's say I am building a portal..
So I create a...
|
by: J Huntley Palmer |
last post by:
Whenever I put in a smarty variable in a link definition as :
<a href="{$foo->bar}">foo</a>,
it shows up as a literal as above in the link and not the contents of
the variable itself....
|
by: grezlik |
last post by:
Hi!
I have major problems with cakephp & smarty, (cake ver is 1.2 and smarty 2.6.18 )
there is a code (from cake/libs/view/view.php
class SmartyView {
..
..
..
|
by: Brennan Mann |
last post by:
Hello, I am having problems updating PHP session variables. I can set
them and see them using the following debug print_r($_SESSION); Once,
I start using smarty templates, I cannot modify the PHP...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |