Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Documentation BUG? : array problem

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
Enquest
Smarty Regular


Joined: 14 May 2003
Posts: 79

PostPosted: Fri May 16, 2003 2:36 pm    Post subject: Documentation BUG? : array problem Reply with quote

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
View user's profile Send private message
AZTEK
Smarty Pro


Joined: 16 Apr 2003
Posts: 235
Location: Purdue University

PostPosted: Fri May 16, 2003 2:43 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Enquest
Smarty Regular


Joined: 14 May 2003
Posts: 79

PostPosted: Fri May 16, 2003 3:35 pm    Post subject: Hmmm Reply with quote

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
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri May 16, 2003 7:14 pm    Post subject: Reply with quote

@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
View user's profile Send private message
Enquest
Smarty Regular


Joined: 14 May 2003
Posts: 79

PostPosted: Mon May 19, 2003 11:43 am    Post subject: thanxs Reply with quote

Mornings, start of fresh day always seem to help.

I'm a fool. Should do $smarty->assign ("$test", array ...
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Bugs All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP