|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Enquest Smarty Regular
Joined: 14 May 2003 Posts: 79
|
Posted: Fri May 16, 2003 2:36 pm Post subject: Documentation BUG? : array problem |
|
|
The following documentation doesn't work!
http://smarty.php.net/manual/en/language.variables.assoc.arrays.php
If you try the following code it wil not call the array element. In fact Smarty won't call anything.
index.php:
$smarty = new Smarty;
$smarty->assign('Contacts',
array('fax' => '555-222-9876',
'email' => 'zaphod@slartibartfast.com',
'phone' => array('home' => '555-444-3333',
'cell' => '555-111-1234')));
$smarty->display('index.tpl');
index.tpl:
{$Contacts.fax}<br>
{$Contacts.email}<br>
{* you can print arrays of arrays as well *}
{$Contacts.phone.home}<br>
{$Contacts.phone.cell}<br>
OUTPUT:
555-222-9876<br>
zaphod@slartibartfast.com<br>
555-444-3333<br>
555-111-1234<br> |
|
Back to top |
|
AZTEK Smarty Pro
Joined: 16 Apr 2003 Posts: 235 Location: Purdue University
|
Posted: Fri May 16, 2003 2:43 pm Post subject: |
|
|
Works perfectly fine for me. What PHP and Smarty version are you using? _________________ "Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane |
|
Back to top |
|
Enquest Smarty Regular
Joined: 14 May 2003 Posts: 79
|
Posted: Fri May 16, 2003 3:35 pm Post subject: Hmmm |
|
|
I use Red Hat 8.0, Mozilla 1.4b
PHP 4.2.x (the install of Red Hat)
I new in Smarty and starting to understand.
version 2.5
Well wath ever I do I'm not able to view those array's as stated in the manual. If I use {section...} then the array's work fine.
But {$Contacts.fax} display's nothing with all might I have. And realy I did look very hard.
Even copying the code directly doesn't work.
So where could the problem be
Any suggestions?
Thanxs |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Fri May 16, 2003 7:14 pm Post subject: |
|
|
@Enquest: I'm confused by your example because the output is consistent with the input.
Perhaps you can post your code that isn't working instead of the manual entry? |
|
Back to top |
|
Enquest Smarty Regular
Joined: 14 May 2003 Posts: 79
|
Posted: Mon May 19, 2003 11:43 am Post subject: thanxs |
|
|
Mornings, start of fresh day always seem to help.
I'm a fool. Should do $smarty->assign ("$test", array ... |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|