<?php
if ($breadcrumb['text'] == 'ABOUT US' && 'CONTACT') {
?>
Trying to show some specific content on pages but when i use a second constant (Contact) it does not work… where am i going wrong?
If you write ‘CONTACT’, that’s not a constant, that’s just a string. Write CONTACT , make sure you have it defined 
contact is the name of the breadcrumb?
In terms of the order of statement / format is this correct?
senshi saidIt should be
<?php if ($breadcrumb['text'] == 'ABOUT US' && 'CONTACT') { ?>Trying to show some specific content on pages but when i use a second constant (Contact) it does not work… where am i going wrong?
<?php
if ($breadcrumb['text'] == 'ABOUT US' && $breadcrumb['text'] == 'CONTACT') {
?>
If you have more page names you want to check against just do a switch statement:
switch ($breadcrumb['text']) {
case 'ABOUT US':
// do something for this page
break;
case 'PORTFOLIO':
// do something for this page
break;
case 'CONTACT':
// do something for this page
break;
}
Or if you want the same functionaliti for more pages do:
switch ($breadcrumb['text']) {
case 'ABOUT US':
case 'PORTFOLIO':
case 'CONTACT':
// do something for this page
break;
}
thanks mate, really appreciate the info!
<?php
if ($breadcrumb['text'] == 'ABOUT US' && $breadcrumb['text'] == 'CONTACT') {
?> this appears to return null on the contact page?<?php if ($breadcrumb['text'] == 'ABOUT US' || $breadcrumb['text'] == 'CONTACT') { ?>
Notice the || instead of &&.Also, if you are not trying to compare actual string but the constant, you should not use ‘CONTACT’ but only CONTACT .
The same goes for ABOUT US .
senshi said
<?php if ($breadcrumb['text'] == 'ABOUT US' && $breadcrumb['text'] == 'CONTACT') { ?>this appears to return null on the contact page?
ram64 is right, you should use the OR statement, instead of &&, here is a useful links with PHP operators: http://www.w3schools.com/php/php_operators.asp
&& is not used correctly in your if statement, currently you are checking if $breadcrumb[‘text’] == is equal first with about us and then with contact, and if that is true, only then execute the if statement.
