the5thace Posted July 4, 2013 Share Posted July 4, 2013 Some of the search results have snippets and some do not so I need an if statement inserted for the cases there aren't any. Seems that when I try to insert an if statement it gets picked up as html. What would be the best way to insert an if here? $Blekko = array ("<a href=\"{$item->url}\"> {$item->url_title}</a> <p> {if (snippet == '') { $item->'No snippet' } $item->snippet}</p>") } Quote Link to comment https://forums.phpfreaks.com/topic/279876-what-is-the-best-way-of-inserting-an-if-statement-here/ Share on other sites More sharing options...
Solution trq Posted July 4, 2013 Solution Share Posted July 4, 2013 You can't put an expression in an array. Your if statement needs to go where you actually use this array, not where you create it. Quote Link to comment https://forums.phpfreaks.com/topic/279876-what-is-the-best-way-of-inserting-an-if-statement-here/#findComment-1439481 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.