I'd like to display the amount of items in the shopping cart on the top of my webpage.
This is what I attempted to do and it works but it doesn't seem to efficient. I am fairly new to php so I don't know efficient ways to code with correct syntax. Hopefully someone can help me reorganize this...Code:<?php if ($_SESSION['cart']->count_contents() != 0) { ?> <a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"> <?php echo HEADER_TITLE_CART_CONTENTS; ?><?php echo ' (' . $shopcartdisplay . ' items)'; ?></a> | <a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><?php echo HEADER_TITLE_CHECKOUT; ?>»</a> <?php }?> <?php if ($_SESSION['cart']->count_contents() == 0) { ?> <a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>"> <?php echo HEADER_TITLE_CART_CONTENTS; ?> (0 items)</a> | <a href="<?php echo zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>"><?php echo HEADER_TITLE_CHECKOUT; ?>»</a> <?php }?>
Basiclly, when theres no items I want it to display (0 items) and when there are items I want it to display (5 items)
---------------
I noticed when there is no item, the printout turns out to be ( items) and it doesn't print out the 0, that is why i had to manually text it out.



