Jump to content

Profile Conditionals


ghinton

Recommended Posts

Posted

Is it possible to do conditionals in the profile display format based on the option choice of a field. For example, let's say I want to show if a member is verified on their profile. Can you do something in the profile display field like

<if $data['pf_content']='Yes'>
    <strong>{title}:</strong> {content}
<else>
nbsp;
</if>

 

Posted

Yes you can do conditionals and futhermore you can include any php code you want.

The syntax is well explain in this document: http://community.invisionpower.com/4docs/advanced-usage/development/template-logic-r73/

And check also this one: http://community.invisionpower.com/4docs/advanced-usage/development/template-tags-r76/

So for example in your case, to make conditionals is very easy, always remember to include your php between {{  }}

{{if $foo}}
   HTML to display
{{elseif $bar}}
   HTML to display
{{elseif $baz}}
   HTML to display
{{else}}
   HTML to display
{{endif}}

 

I don't understand what do you want to say for "a member is verified on their profile", but the previous code at least will give you a base to start your tests ;)
 

Posted

Yes you can do conditionals and futhermore you can include any php code you want.

The syntax is well explain in this document: http://community.invisionpower.com/4docs/advanced-usage/development/template-logic-r73/

And check also this one: http://community.invisionpower.com/4docs/advanced-usage/development/template-tags-r76/

So for example in your case, to make conditionals is very easy, always remember to include your php between {{  }}

{{if $foo}}
   HTML to display
{{elseif $bar}}
   HTML to display
{{elseif $baz}}
   HTML to display
{{else}}
   HTML to display
{{endif}}

 

I don't understand what do you want to say for "a member is verified on their profile", but the previous code at least will give you a base to start your tests ;)
 

​Thank you for linking those documents.  :smile:

Posted

You are welcome :)

 

Take in account that if you are starting to modify templates in IPS, it exists a very good section of the website where you  can find documentation for developers, you can find it in the header of this forum, in the bottom "IPS4 Resources" - Documentation

Right now this section is not so complete as the documentation for IPS3 but this is normal becauser version 4 is pretty new and I am sure the inivision team will add more and more documents.

For my side I would like to make a basic guide with everything I have learned about how to integrate your personal website with IPS4. I am not an expert so I think I will help many people like me who is also lost at the beggining

Posted

You are welcome :)

 

Take in account that if you are starting to modify templates in IPS, it exists a very good section of the website where you  can find documentation for developers, you can find it in the header of this forum, in the bottom "IPS4 Resources" - Documentation

Right now this section is not so complete as the documentation for IPS3 but this is normal becauser version 4 is pretty new and I am sure the inivision team will add more and more documents.

For my side I would like to make a basic guide with everything I have learned about how to integrate your personal website with IPS4. I am not an expert so I think I will help many people like me who is also lost at the beggining

That would be great!  I was comfortable with IPB 3x, but I've taken a step back with IPB 4x.  Primarily with template conditionals, it has changed.  I need to settle in and familiarize myself with it.  It feels like I'm starting all over again.  :tongue:

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...