如何在关闭magento中的body标记之前调用css

如何在关闭magento中的body标记之前调用css,magento,Magento,每次关闭magento中的body标记之前,请在中调用css 将显示错误,我在主体标记关闭之前添加了所有js,但当我尝试添加css时,它将显示错误 1st method=>js和css不工作并显示错误 local.xml 皮肤_csscss/abc.css skin_js/share_button.js 2col.phtml=>在关闭body标记之前 第二种方法 js不工作,无错误 local.xml 页脚/js.phtml 在local.xml中 <?xml version="1.0"

每次关闭magento中的
body
标记之前,请在中调用
css
将显示错误,我在主体标记关闭之前添加了所有
js
,但当我尝试添加
css
时,它将显示错误

1st method=>js和css不工作并显示错误

local.xml
皮肤_csscss/abc.css
skin_js/share_button.js
2col.phtml=>在关闭body标记之前
第二种方法 js不工作,无错误

local.xml
页脚/js.phtml
在local.xml中

<?xml version="1.0"?>
<layout version="0.1.0">
    <default>
        <remove name="right.poll"/>
        <reference name="head">
          <action method="addCss"><stylesheet>css/owl.theme.css</stylesheet></action>
          <action method="addCss"><stylesheet>css/owl.carousel.css</stylesheet></action>
          <action method="addCss"><stylesheet>css/bootstrap.min.css</stylesheet></action>
          <action method="addCss"><stylesheet>css/font-awesome.min.css</stylesheet></action>
          <action method="addCss"><stylesheet>css/custom-style.css</stylesheet></action>

          <action method="addItem"><type>skin_js</type><name>js/bootstrap.min.js</name></action>
           <action method="addItem"><type>skin_js</type><name>js/responsive-accordion.min.js</name></action>
          <action method="addItem"><type>skin_js</type><name>js/responsiveCarousel.min.js</name></action>
          <action method="addItem"><type>skin_js</type><name>js/jquery.hammer.min.js</name></action>
          <action method="addItem"><type>skin_js</type><name>js/custom.js</name></action> 
           <action method="addLinkRel"><rel>stylesheet</rel><href>//fonts.googleapis.com/css?family=Montserrat:400,700</href></action>
           <action method="addLinkRel"><rel>stylesheet</rel><href>//fonts.googleapis.com/css?family=Raleway:400,900,800,700,600,300</href></action>
          <!--Remove CSS and JS, skin Folder-->
           <!--action method="removeItem"><type>skin_css</type><name>css/styles.css</name></action-->

        </reference>
    </default>

css/owl.theme.css
css/owl.carousel.css
css/bootstrap.min.css
css/font-awesome.min.css
css/custom-style.css
skin_jsjs/bootstrap.min.js
skin_jsjs/responsive-accordion.min.js
skin_jsjs/responsiveCarousel.min.js
skin_jsjs/jquery.hammer.min.js
skin_jsjs/custom.js
样式表//font.googleapis.com/css?family=Montserrat:400700
样式表//font.googleapis.com/css?family=ralway:400900800700600300

在\u body\u end之前有一个名为的块,您可以使用模板或文本块添加所需的所有内容

您需要这样的东西,您也没有页面/html\u头块可参考:

<!-- get the block which we want our content in -->
<reference name="before_body_end">
    <!-- add another block of type page/html_head to have all the great functionality to add/remove css and js stuff -->
    <!-- it is important to set your own template, because the head block has a defined default template page/head.phtml which has all the stuff of the head. Using this will bring a lot of problems -->
    <block type="page/html_head" name="scripts_in_footer" template="YOUR TEMPLATE">
        <!-- add whatever you want as you are used to in the head via the standard magento api -->
        <action method="addItem"><type>skin_css</type><name>css/styles.css</name></action>
    </block>
</reference>

skin_csscss/styles.css
在模板内部,您需要:

<?php // and to echo the whole stuff later in the template, you need to add the code, so the added js/Css files are echoed ?>
<?php echo $this->getCssJsHtml() ?>
<?php echo $this->getChildHtml() ?>

local.xml

<reference name="before_body_end">
           <!-- add another block of type page/html_head to have all the great functionality to add/remove css and js stuff -->
           <!-- it is important to set your own template, because the head block has a defined default template page/head.phtml which has all the stuff of the head. Using this will bring a lot of problems -->
           <block type="page/html_head" name="abc" template="footer/abc.phtml">
               <!-- add whatever you want as you are used to in the head via the standard magento api -->
               <action method="addItem"><type>skin_css</type><name>css/negi.css</name></action>
           </block>
       </reference>
<?php echo $this->getCssJsHtml() ?>
<?php echo $this->getChildHtml() ?>

skin_csscss/negi.css
Yourtheme/template/footer/abc.phtml

<reference name="before_body_end">
           <!-- add another block of type page/html_head to have all the great functionality to add/remove css and js stuff -->
           <!-- it is important to set your own template, because the head block has a defined default template page/head.phtml which has all the stuff of the head. Using this will bring a lot of problems -->
           <block type="page/html_head" name="abc" template="footer/abc.phtml">
               <!-- add whatever you want as you are used to in the head via the standard magento api -->
               <action method="addItem"><type>skin_css</type><name>css/negi.css</name></action>
           </block>
       </reference>
<?php echo $this->getCssJsHtml() ?>
<?php echo $this->getChildHtml() ?>

2col.phtml=>在结束正文标记之前

<?php echo $this->getChildHtml('abc') ?>


你能发布你的代码和你得到的错误吗?你能告诉我这个代码出了什么问题吗???你有链接来分享你的网站吗?这是什么?我说的是如何在关闭主体标签之前添加css而不是在头部?你只需使用在主体之前添加这个来添加页面中你想要的内容。没有其他方法。如果我们将其包含在local.xml中,那么它将添加到head标记中。所以你可以像上面那样添加它。我也在从js.phtml调用css…请有人帮助我,我再次无法工作,也有错误,感谢阿鲁南德拉,这不是在你的身体结束之前,而是在你的身体结束之前,这是一个愚蠢的错误。你以前的答案有效。这个答案无效…@Rahul negi我已经发布了我以前的答案,请随意接受。@jibin它可能会对你有所帮助