0

Here is the code below I am trying to say if that block is equal or less than 1000px height show the logo else the texting text. I can't figure out what I am doing wrong. Please remember this is inside magento is there a better way to write this I think with jquery right?

 <?php if (css class >= height of 62px): 
 echo '<h1 class="logo"><strong><?php echo $this->getLogoAlt() ?></strong>
 <a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><img src="<?php echo $this->getLogoSrc() ?>" <?php echo MAGE::helper('ThemeOptions/Retina')->getRetinaData('logo'); ?> alt="<?php echo $this->getLogoAlt() ?>" /></a></h1>';
         else: echo '<p> Testing </p>'; 
         endif; ?>
2
  • nested <?php tag does not work Commented Jun 20, 2013 at 18:03
  • ok now please help explain Commented Jun 20, 2013 at 18:24

1 Answer 1

1

Pretty straightforward comment. Learn to see code, it has structure. It is formulated in a particular way depending on where it is used.

Nested PHP tags don't work

<?php if :
  <?php ... ?>
?>

For php scripting where php code is predominant and the html is being generated as echo statements, this is the structure:

<?php

if (css class >= height of 62px) {
    echo '<h1 class="logo"><strong>' . $this->getLogoAlt() . '</strong>';
    echo '<a href="' . $this->getUrl('') . '" title="' . $this->getLogoAlt() . '" class="logo">';
    echo '<img src="' . $this->getLogoSrc() . '" ' . MAGE::helper('ThemeOptions/Retina')->getRetinaData('logo') . '" alt="' . $this->getLogoAlt() . '" />';
    echo '</a></h1>';
} else {
    echo '<p> Testing </p>'; 
}

?>

For html scripting where html tags are predominant and the PHP code is included as tags within html, this is the structure:

<?php if (css class >= height of 62px): ?>
   <h1 class="logo"><strong><?php echo $this->getLogoAlt() ?></strong>
   <a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><img src="<?php echo $this->getLogoSrc() ?>" 
   <?php echo MAGE::helper('ThemeOptions/Retina')->getRetinaData('logo') ?> alt="<?php echo $this->getLogoAlt() ?>" /></a></h1>
<?php else: ?>
   <p> Testing </p> 
<?php endif; ?>

NOTE: That if test and a couple other things in this code kind of render it to be pseudocode, probably not actually usable working Magento php. More work needs to be done with it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.