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>") } 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...
trq Posted July 4, 2013 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. 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
Archived
This topic is now archived and is closed to further replies.