I’m trying to get a message to display if a class is present, not sure if I’ve got the right idea with this or not but it doesn’t appear to be showing anything even though the class is there on the page.
<?php if (class_exists('quote-me')): ?>
<?php echo $this->__('View Quotation'); ?>
<?php endif; ?>
Can someone let me know if I’m on the right track.
class_exists()only checks if the class has been defined, not if you currently have an instance of that class. You could have thequote-meclass defined and in scope, triggering theifblock, but that by itself doesn’t mean you have a valid instance of that class.Assuming that
$this->__('View Quotation');works if you have an instance, then the fact that it’s not working could be an indication that you actually don’t have an instance of thequote-meclass in scope.