nexissair Posted November 5, 2013 Report Share Posted November 5, 2013 Hi all Could someone please help me out, I think the solution is so simple but I just can't see it with limited PHP skills. Ok I have multiple airlines but my schedules all come under the airline code "NEX" as the other airlines are for charters, code share etc. so I have filtered my NEX schedules on the results.tpl like so which works a treat: <?php foreach($allroutes as $route) { if ($route->code != 'NEX') continue; But I wanted to show two or more airline codes in the schedule results.tpl like "NEX" and"3XE" but not any others how would I adjust the code? I've tried a few things but with no success. Many thanks Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted November 5, 2013 Members Report Share Posted November 5, 2013 You can have a look at logical operators here is a link that explains it http://php.net/manua...ors.logical.php in your case now and without me being able to try it out try <?php foreach($allroutes as $route) { if ($route->code != 'NEX' || '3XE') continue; Quote Link to comment Share on other sites More sharing options...
nexissair Posted November 5, 2013 Author Report Share Posted November 5, 2013 You can have a look at logical operators here is a link that explains it http://php.net/manua...ors.logical.php in your case now and without me being able to try it out try <?php foreach($allroutes as $route) { if ($route->code != 'NEX' || '3XE') continue; Many thanks, the link is very interesting I will have a good read through the whole thing time permitting, I tried the code you supplied but it didn't work, still only showed the NEX schedules. Quote Link to comment Share on other sites More sharing options...
Members Vangelis Posted November 5, 2013 Members Report Share Posted November 5, 2013 Yes my bad because || is or try replacing || with && Quote Link to comment Share on other sites More sharing options...
mseiwald Posted November 5, 2013 Report Share Posted November 5, 2013 i think this will work. foreach($allroutes as $route) { if ($route->code != 'NEX' || $route->code != '3XE') { continue; } You have to use OR && wont work for this. Quote Link to comment Share on other sites More sharing options...
nexissair Posted November 9, 2013 Author Report Share Posted November 9, 2013 i think this will work. foreach($allroutes as $route) { if ($route->code != 'NEX' || $route->code != '3XE') { continue; } You have to use OR && wont work for this. Thanks for this but it still doesn't work, its doing my head in now, it should be so simple :-( Quote Link to comment Share on other sites More sharing options...
mseiwald Posted November 9, 2013 Report Share Posted November 9, 2013 how many codes do you have that you want to show? Quote Link to comment Share on other sites More sharing options...
nexissair Posted November 11, 2013 Author Report Share Posted November 11, 2013 how many codes do you have that you want to show? ideally 4 airline codes with one or more hidden Quote Link to comment 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.