简体   繁体   English

将phtml文件添加到magento中的静态块

[英]Adding phtml file to static blocks in magento

I am new to magento. 我是magento的新手。 And while creating static block on my own in magento dashboard, it doesnt compile php code. 虽然我自己在magento仪表板中创建静态块,但它不会编译PHP代码。 So i need to call a phtml file But I am not sure what needs to be done for this. 所以我需要调用一个phtml文件但我不确定需要做什么。 The code I need to put in static block is : 我需要在静态块中放入的代码是:

<div class="account-login">
<div class="page-title">
    <h1><?php echo $this->__('Login or Create an Account') ?></h1>
</div>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form">
    <?php echo $this->getBlockHtml('formkey'); ?>
    <div class="col2-set">
        <div class="col-1 new-users">
            <div class="content">
                <h2><?php echo $this->__('New Customers') ?></h2>
                <p><?php echo $this->__('By creating an account with our store, you will be able to move through the checkout process faster, store multiple shipping addresses, view and track your orders in your account and more.') ?></p>
            </div>
        </div>
        <div class="col-2 registered-users">
            <div class="content">
                <h2><?php echo $this->__('Registered Customers') ?></h2>
                <p><?php echo $this->__('If you have an account with us, please log in.') ?></p>
                <ul class="form-list">
                    <li>
                        <label for="email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
                        <div class="input-box">
                            <input type="text" name="login[username]" value="<?php echo $this->escapeHtml($this->getUsername()) ?>" id="email" class="input-text required-entry validate-email" title="<?php echo $this->__('Email Address') ?>" />
                        </div>
                    </li>
                    <li>
                        <label for="pass" class="required"><em>*</em><?php echo $this->__('Password') ?></label>
                        <div class="input-box">
                            <input type="password" name="login[password]" class="input-text required-entry validate-password" id="pass" title="<?php echo $this->__('Password') ?>" />
                        </div>
                    </li>
                    <?php echo $this->getChildHtml('form.additional.info'); ?>
                    <?php echo $this->getChildHtml('persistent.remember.me'); ?>
                </ul>
                <?php echo $this->getChildHtml('persistent.remember.me.tooltip'); ?>
                <p class="required"><?php echo $this->__('* Required Fields') ?></p>
            </div>
        </div>
    </div>
    <div class="col2-set">
        <div class="col-1 new-users">
            <div class="buttons-set">
                <button type="button" title="<?php echo $this->__('Create an Account') ?>" class="button" onclick="window.location='<?php echo Mage::helper('persistent')->getCreateAccountUrl($this->getCreateAccountUrl()) ?>';"><span><span><?php echo $this->__('Create an Account') ?></span></span></button>
            </div>
        </div>
        <div class="col-2 registered-users">
            <div class="buttons-set">
                <a href="<?php echo $this->getForgotPasswordUrl() ?>" class="f-left"><?php echo $this->__('Forgot Your Password?') ?></a>
                <button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><span><?php echo $this->__('Login') ?></span></span></button>
            </div>
        </div>
    </div>
    <?php if (Mage::helper('checkout')->isContextCheckout()): ?>
        <input name="context" type="hidden" value="checkout" />
    <?php endif; ?>
</form>
<script type="text/javascript">
//<![CDATA[
    var dataForm = new VarienForm('login-form', true);
//]]>
</script>

您可以在主题中创建自定义模板文件,并将该文件称为静态块

{{block type="core/template" template="templateFolder/your_template.phtml"}}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM