Displaying icon inline

I am displaying two icons but they are showing one on top of the other. I would like to display them inline but I cannot figure out how. I tried replacing all the

with however that didnt work. Below is the code for displaying the icons. <?php $silverBox = Sabai::h($entity->getSingleFieldValue('field_fipsilver'));?>
        <?php if (!empty($silverBox)):?>
          <div>
            <?php   echo '<img src=http://www.bigcityshare.com/wp-content/uploads/2018/05/FIC-Silver-3-snip.jpg border=1px solid red width=115px height=115px/></p>'?>
          </div>
        <?php endif;?>

        <?php
          $goldBox = Sabai::h($entity->getSingleFieldValue('field_fipgold'));?>
          <?php if (!empty($goldBox)):?>
            <div>
              <?php   echo '<img src=http://www.bigcityshare.com/wp-content/uploads/2018/05/FIC-Gold-3-snip.jpg border=1px solid red width=115px height=115px/></p>'?>
            </div>
          <?php endif;?>

Perhaps you should learn about CSS. This is the standard way to align DIV’s and other elements.

Look into CSS styling for BLOCK and INLINE-BLOCK. Sometimes you also need to use FLOAT: LEFT to set the elements side by side. Once you have read up on these and tried them, let us know if you have further questions.

Also, why do you use echo for some HTML and not for others. Here is a better layout for you:
[php]

<?php $silverBox = Sabai::h($entity->getSingleFieldValue('field_fipsilver')); if (!empty($silverBox)): :?>
          <div>
             <img src=http://www.bigcityshare.com/wp-content/uploads/2018/05/FIC-Silver-3-snip.jpg border=1px solid red width=115px height=115px/></p>
          </div>
<?php endif; $goldBox = Sabai::h($entity->getSingleFieldValue('field_fipgold')); if (!empty($goldBox)): ?>
            <div>
            <img src=http://www.bigcityshare.com/wp-content/uploads/2018/05/FIC-Gold-3-snip.jpg border=1px solid red width=115px height=115px/></p>
            </div>
<?php endif; ?>

[/php]
( Note also that the assignment for silver/gold box and the if can be combined into one line so the variables do not need to be assigned. Runs faster. Something like: if(!empty(Sabai::h($entity->getSingleFieldValue(‘field_fipsilver’))): )

Good luck! ( PS: PLEASE place your code inside of the PHP tags above as it makes it easier for us! )

Sponsor our Newsletter | Privacy Policy | Terms of Service