List Info

Thread: Using arrays as input to plugins




Using arrays as input to plugins
user name
2006-04-26 21:58:36
See the manual:
http://smarty.php.net/manual/en/language.syntax.quotes
.php


Jeroen

----- Original Message ----- 
From: "Cody Caughlan" <toolbaggmail.com>
To: <smarty-generallists.php.net>
Sent: Wednesday, April 26, 2006 6:23 PM
Subject: [SMARTY] Using arrays as input to plugins


Hello-

I have noticed some odd stuff going on with using
associative arrays
and the "." syntax. When I am handing off data
to a plugin, or any
other Smarty plugin (e.g. ), it doesnt handle using
associative arrays.

E.g.

$foobar = array('file' => 'foo.tpl');
$smarty->assign("foobar", $foobar);

---- foo.tpl ---

{include file=$foobar.file}

What happens is that it looks for a variable called
"$foobar", doesnt
find it, so returns the empty string and then just appends
".file"...basically Smarty doesnt "dive
into" the array, as it would
if I just did:

You are looking for {$foobar.file}

In my case I have written a plugin "dispText"
and am trying to call it as 
such:

{dispText name="Name"
value="$navItem.Name" label=$lblName
readOnly=$navItem.readOnly}

Where $navItem is an associative array I have previously
assigned, and
those key names definitely exist. When my plugin executes it
creates a
form input of type text and then in the value portion just
display
".Name" because it cannot extract that value
from the array $navItem
using the key as I have defined it.

So is there a way I can get it to read the array values
WITHOUT doing
an  first and pulling all of my values out. That
would really
suck. I would think this is a core parser change and hence
its not so
quick and easy.

Thanks
/Cody

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )