1

I'm trying to write an if statement that will pull the image label from the cms image area. If its not populated it will insert the image file name. The first part of the statement works. However the filename is not being pulled in.

    <?php if ($this->getImageLabel()): ?>


        <li><!--Inside Light Box Render-->
            <a href="<?php echo $popUpImage; ?>" rel="<?php echo $rel; ?>" class="<?php echo $class; ?>" 
                title="<?php echo $this->escapeHtml($_image->getLabel()) ?>">
            <img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize($thumbnailSize[0], $thumbnailSize[1]); ?>" 
            alt="<?php echo $this->escapeHtml($_image->getLabel()) ?>" />
            </a>
        </li>   


<?php else: ?>

        <li><!--Inside Light Box Render-->
            <a href="<?php echo $popUpImage; ?>" rel="<?php echo $rel; ?>" class="<?php echo $class; ?>" 
                title="<?php echo $this->escapeHtml($_image->getFile()) ?>">
            <img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize($thumbnailSize[0], $thumbnailSize[1]); ?>" 
            alt="<?php echo $this->escapeHtml($_image->getLabel()) ?>" />
            </a>
        </li>   

<?php endif; ?>        
2
  • What are you trying to accomplish with this code? Can you describe it please? Oct 9, 2015 at 15:45
  • In a gallery lightbox the image label displays under the image. Ultimately, If the field is blank in the admin I would like the file name to show. It would be stripped of the file type, non-alphbetical characters, and the first letter capitalize. The stripped part is what Im working on after the else statement renders. Oct 9, 2015 at 15:53

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.