Skip to main content
added 268 characters in body
Source Link

I've setup a custom .phtml block that I need to add in various places in a couple of different files. To do this I'm using the following code:

<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('page/template/newsletter.phtml')->toHtml(); ?>

For some reason, this seems to be rendering some random Whitespace before the block itself, see attached image.

enter image description here

I'm using Magento 1.9.1

Here are the contents of my custom .phtml file, although from playing with the template calling it I'm pretty sure the whitespace is added in before the block/content!

<div class="newsletter-signup padded-block">
    <h2 class="major">
        <?php echo $this->__('Email Signup') ?>
    </h2>
    <div class="content">
        <div class="newsletter-name">
            <select class="newsletter-title">
                <option value="Mr">Mr</option>
                <option value="Mrs">Mrs</option>
                <option value="Miss">Miss</option>
                <option value="Ms">Ms</option>
                <option value="Dr">Dr</option>
            </select>
            <input type="text" class="newsletter-firstname" placeholder="First Name">
            <input type="text" class="newsletter-lastname" placeholder="Last Name">
        </div>
    </div>
        <input type="text" class="disabled" placeholder="Your name" disabled>
        <input type="email" class="" placeholder="Email address">
</div>

I'm calling this from a Template file with the following code:

        <div class="col-xs-4 col-sm-4 col-md-12 newsletter-block">
            <?php echo $this->getLayout()->createBlock('core/template')->setTemplate('page/template/newsletter.phtml')->toHtml(); ?>
        </div>

I've setup a custom .phtml block that I need to add in various places in a couple of different files. To do this I'm using the following code:

<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('page/template/newsletter.phtml')->toHtml(); ?>

For some reason, this seems to be rendering some random Whitespace before the block itself, see attached image.

enter image description here

I'm using Magento 1.9.1

Here are the contents of my custom .phtml file, although from playing with the template calling it I'm pretty sure the whitespace is added in before the block/content!

<div class="newsletter-signup padded-block">
    <h2 class="major">
        <?php echo $this->__('Email Signup') ?>
    </h2>
    <div class="content">
        <div class="newsletter-name">
            <select class="newsletter-title">
                <option value="Mr">Mr</option>
                <option value="Mrs">Mrs</option>
                <option value="Miss">Miss</option>
                <option value="Ms">Ms</option>
                <option value="Dr">Dr</option>
            </select>
            <input type="text" class="newsletter-firstname" placeholder="First Name">
            <input type="text" class="newsletter-lastname" placeholder="Last Name">
        </div>
    </div>
        <input type="text" class="disabled" placeholder="Your name" disabled>
        <input type="email" class="" placeholder="Email address">
</div>

I've setup a custom .phtml block that I need to add in various places in a couple of different files. To do this I'm using the following code:

<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('page/template/newsletter.phtml')->toHtml(); ?>

For some reason, this seems to be rendering some random Whitespace before the block itself, see attached image.

enter image description here

I'm using Magento 1.9.1

Here are the contents of my custom .phtml file, although from playing with the template calling it I'm pretty sure the whitespace is added in before the block/content!

<div class="newsletter-signup padded-block">
    <h2 class="major">
        <?php echo $this->__('Email Signup') ?>
    </h2>
    <div class="content">
        <div class="newsletter-name">
            <select class="newsletter-title">
                <option value="Mr">Mr</option>
                <option value="Mrs">Mrs</option>
                <option value="Miss">Miss</option>
                <option value="Ms">Ms</option>
                <option value="Dr">Dr</option>
            </select>
            <input type="text" class="newsletter-firstname" placeholder="First Name">
            <input type="text" class="newsletter-lastname" placeholder="Last Name">
        </div>
    </div>
        <input type="text" class="disabled" placeholder="Your name" disabled>
        <input type="email" class="" placeholder="Email address">
</div>

I'm calling this from a Template file with the following code:

        <div class="col-xs-4 col-sm-4 col-md-12 newsletter-block">
            <?php echo $this->getLayout()->createBlock('core/template')->setTemplate('page/template/newsletter.phtml')->toHtml(); ?>
        </div>
added 986 characters in body
Source Link

I've setup a custom .phtml block that I need to add in various places in a couple of different files. To do this I'm using the following code:

<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('page/template/newsletter.phtml')->toHtml(); ?>

For some reason, this seems to be rendering some random Whitespace before the block itself, see attached image.

enter image description here

I'm using Magento 1.9.1

Here are the contents of my custom .phtml file, although from playing with the template calling it I'm pretty sure the whitespace is added in before the block/content!

<div class="newsletter-signup padded-block">
    <h2 class="major">
        <?php echo $this->__('Email Signup') ?>
    </h2>
    <div class="content">
        <div class="newsletter-name">
            <select class="newsletter-title">
                <option value="Mr">Mr</option>
                <option value="Mrs">Mrs</option>
                <option value="Miss">Miss</option>
                <option value="Ms">Ms</option>
                <option value="Dr">Dr</option>
            </select>
            <input type="text" class="newsletter-firstname" placeholder="First Name">
            <input type="text" class="newsletter-lastname" placeholder="Last Name">
        </div>
    </div>
        <input type="text" class="disabled" placeholder="Your name" disabled>
        <input type="email" class="" placeholder="Email address">
</div>

I've setup a custom .phtml block that I need to add in various places in a couple of different files. To do this I'm using the following code:

<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('page/template/newsletter.phtml')->toHtml(); ?>

For some reason, this seems to be rendering some random Whitespace before the block itself, see attached image.

enter image description here

I'm using Magento 1.9.1

I've setup a custom .phtml block that I need to add in various places in a couple of different files. To do this I'm using the following code:

<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('page/template/newsletter.phtml')->toHtml(); ?>

For some reason, this seems to be rendering some random Whitespace before the block itself, see attached image.

enter image description here

I'm using Magento 1.9.1

Here are the contents of my custom .phtml file, although from playing with the template calling it I'm pretty sure the whitespace is added in before the block/content!

<div class="newsletter-signup padded-block">
    <h2 class="major">
        <?php echo $this->__('Email Signup') ?>
    </h2>
    <div class="content">
        <div class="newsletter-name">
            <select class="newsletter-title">
                <option value="Mr">Mr</option>
                <option value="Mrs">Mrs</option>
                <option value="Miss">Miss</option>
                <option value="Ms">Ms</option>
                <option value="Dr">Dr</option>
            </select>
            <input type="text" class="newsletter-firstname" placeholder="First Name">
            <input type="text" class="newsletter-lastname" placeholder="Last Name">
        </div>
    </div>
        <input type="text" class="disabled" placeholder="Your name" disabled>
        <input type="email" class="" placeholder="Email address">
</div>
Source Link

Mystery whitespace before calling ->createBlock

I've setup a custom .phtml block that I need to add in various places in a couple of different files. To do this I'm using the following code:

<?php echo $this->getLayout()->createBlock('core/template')->setTemplate('page/template/newsletter.phtml')->toHtml(); ?>

For some reason, this seems to be rendering some random Whitespace before the block itself, see attached image.

enter image description here

I'm using Magento 1.9.1