You are saying "if it is not page A, or not page B, or not page C, include..., which means it will include as long as the page is not somehow equal to all three pages.
Insead of "||" (OR) use "&&" (AND).
Like:
if(($PHP_SELF != "/view_cart.php") && ($PHP_SELF != "/checkout.php") && ($PHP_SELF != "/checkout_complete.php")) {
include("cart_contents.inc");
}
This says if it is not equal to A, and not equal to B, and not equal to C, include...