View previous topic :: View next topic |
Author |
Message |
mischa Smarty Rookie
Joined: 30 Apr 2003 Posts: 19 Location: Suhr, Switzerland
|
Posted: Mon Jun 16, 2003 3:41 pm Post subject: objects in smarty |
|
|
Hi
I've the following problem if i use the following code:
Code: |
{assign var=test value="Example: $obj->name"}
{$test}
output:
Example: Object->name
|
i've to do a workaround:
Code: |
{assign var=name value=$obj->name
{assign var=test value="Example: $name"}
{$test}
|
is there another solution like "Example: ".$obj or something else? would this be fixed in the next Smarty-Version?
thanks a lot.
Mischa |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
|
Back to top |
|
mischa Smarty Rookie
Joined: 30 Apr 2003 Posts: 19 Location: Suhr, Switzerland
|
Posted: Mon Jun 16, 2003 8:07 pm Post subject: |
|
|
i've tried the following code:
Code: |
{assign var=test value="test: `$addr->addr_id`"}
{$test}
output:
test: `Object->addr_id`
|
is my code wrong? do i use the wrong quotes?
i use smarty-version 2.5.0.
thanks for help. |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Mon Jun 16, 2003 8:41 pm Post subject: |
|
|
um, sorry. i would have expected your example to work. i see it doesn't.
it seems you have to work around it with a 2nd {assign} for now.but i will see if we can fix this for the next version of smarty. |
|
Back to top |
|
mischa Smarty Rookie
Joined: 30 Apr 2003 Posts: 19 Location: Suhr, Switzerland
|
Posted: Mon Jun 16, 2003 9:30 pm Post subject: |
|
|
ok. that's no problem for me.
and thanks for helping! |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Tue Jun 17, 2003 12:08 am Post subject: |
|
|
I agree that mischa's syntax SHOULD work.
Meanwhile, try this:
{assign var=test value="test"|concat:$addr->addr_id} |
|
Back to top |
|
mischa Smarty Rookie
Joined: 30 Apr 2003 Posts: 19 Location: Suhr, Switzerland
|
Posted: Tue Jun 17, 2003 8:00 am Post subject: |
|
|
concat doesn't work, but with
Code: |
{assign var=test value="test"|cat:$addr->addr_id}
|
it works!
thanks, my code will be a little bit shortet. i hope the new version with a bugfix coming soon! |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Tue Jun 17, 2003 8:27 am Post subject: |
|
|
I did type concat! sheesh. Thanks for posting the correction, mischa |
|
Back to top |
|
mischa Smarty Rookie
Joined: 30 Apr 2003 Posts: 19 Location: Suhr, Switzerland
|
Posted: Tue Jun 17, 2003 8:33 am Post subject: |
|
|
no problem!
i guess it's the weather... too hot for programming! |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Thu Jun 19, 2003 12:07 am Post subject: |
|
|
the cvs-version of smarty recognizes -> in backticks correctly. i must have overlooked that somebody has fixed this already. |
|
Back to top |
|
|