Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

If/Else Statement In Template Using in_array

 
Post new topic   Reply to topic    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
mobiledotcom
Smarty n00b


Joined: 07 Mar 2019
Posts: 1

PostPosted: Thu Mar 07, 2019 3:55 pm    Post subject: If/Else Statement In Template Using in_array Reply with quote

Hello,

In PHP I have an array that contains a lot of data and I need to create an If/Else statement in the template based on one specific line.

The array looks like this (I'm omitting the other 52 lines):

Code:

$clientsdetails
[52 other lines I omitted]
twofaenabled => false


Inside the template, if twofaenabled => false I want to show specific content. If true, I don't want the content to show.

How can I accomplish this?

Thanks!
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1572

PostPosted: Thu Mar 07, 2019 8:50 pm    Post subject: Reply with quote

You don't need in_array for that.
Just
Code:
{if empty($data.twofaenabled)} {/if}
is sufficient.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1572

PostPosted: Thu Mar 07, 2019 8:54 pm    Post subject: Reply with quote

Wondering twhat this have to do with Smarty Development. Moved.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> General 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