solved Could we write conditions in {jrCore_list} function?

JamBoy
JamBoy
@ashiksh
10 years ago
13 posts

{if $item.type eq 'country'}
search2="profile_country = $country"
{elseif $item.type eq 'state'}
search2="profile_state = $state"
{/if}

{jrCore_list module="jrProfile" search1="profile_sub_category = $subcat" order_by=$order_by template="profile_row.tpl"}

Could i do something like this with "IF" condition
updated by @ashiksh: 11/26/14 04:39:16PM
michael
@michael
10 years ago
7,746 posts
Is that a question? Because it looks a lot like an answer.

Sure you can use conditions.

Try this:
{if $item.type eq 'country'}
{$search_var = "profile_country = $country"}
{elseif $item.type eq 'state'}
{$search_var = "profile_state = $state"}
{/if}

{jrCore_list module="jrProfile" search1=$search_var order_by=$order_by  template="profile_row.tpl"}

Try that.

If that doesnt work you might try putting back ticks around the $country / $state
{$search_var = "profile_state = `$state`"}
or perhaps squiggly brackets.
{$search_var = "profile_state = {$state}"}
paul
@paul
10 years ago
4,332 posts
The tics around the variables always works for me. I think putting squiggly brackets will cause an error.


--
Paul Asher - JR Developer and System Import Specialist
michael
@michael
10 years ago
7,746 posts
I thought that too, but there are places that use squiggly brackets inside a squiggly bracket function call.
brian
@brian
10 years ago
10,148 posts
michael:
I thought that too, but there are places that use squiggly brackets inside a squiggly bracket function call.

This never worked on Smarty 2, but does work in some cases with Smarty 3 as I've seen that as well ;)


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net

Tags