|
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 |
mech7 Smarty n00b
Joined: 11 Dec 2007 Posts: 3
|
Posted: Fri Jan 04, 2008 10:52 am Post subject: array_key_exists |
|
|
Is there a way to use this function inside templates? or any other function to check if the value exists? |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Fri Jan 04, 2008 3:01 pm Post subject: |
|
|
You mean like:
{if isset( $foo.bar ) }
or
{if $foo.bar|isset}
or
{if array_key_exists('bar', $foo ) }
or
{if 'bar'|array_key_exists:$foo}
?
Consider showing a more explicit example of your need.
HTH |
|
Back to top |
|
Aldekein Smarty Rookie
Joined: 24 Jan 2008 Posts: 5 Location: Ukraine
|
Posted: Thu Jan 24, 2008 12:12 pm Post subject: |
|
|
boots wrote: | You mean like:
{if isset( $foo.bar ) }
or
{if $foo.bar|isset}
|
is there a way to get it to work?...
I wrote a custom modifier for the second case but it does not produce required results. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu Jan 24, 2008 3:32 pm Post subject: |
|
|
boots
For some reason isset can't be used as modifier. It creates the following error:
Fatal error: Smarty error: [in xxx.tpl line 3]: [plugin] modifier 'isset' is not implemented (core.load_plugins.php, line 118) |
|
Back to top |
|
Aldekein Smarty Rookie
Joined: 24 Jan 2008 Posts: 5 Location: Ukraine
|
Posted: Fri Jan 25, 2008 8:31 am Post subject: |
|
|
U.Tews wrote: | boots
For some reason isset can't be used as modifier. It creates the following error:
Fatal error: Smarty error: [in xxx.tpl line 3]: [plugin] modifier 'isset' is not implemented (core.load_plugins.php, line 118) |
if you write a custom plugin for smarty - you can, I tried. But it produces not that results that you expect... |
|
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
|