如何在footer.phtml文件中调用内置日历块?
app/design/frontend/base/default/template/page/js/calendar.phtml.
如何在footer.phtml中将该文件称为块? (即:我们写的时事通讯
<?php echo $this->getLayout()->createBlock('newsletter/subscribe')->setTemplate('newsletter/subscribe.phtml')->toHtml(); ?>
在footer.phtml中)
-Thanks
答案 0 :(得分:0)
尝试
<reference name="head">
<action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action>
<action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
<action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
</reference>
在calendar.phtml中
<input type="text" name="date_from" id="date_from" value="" />
<script type="text/javascript">
Calendar.setup({
inputField : 'date_from',
ifFormat : '%m/%e/%y',
button : 'date_from_trig',
align : 'Bl',
singleClick : true
});
</script>
在footer.phtml中
echo $this->getLayout()->createBlock(
'core/template',
'calendar_block',
array('template' => 'path/to/calendar.phtml')
)->toHtml();
请参阅Magento - How do I add a frontend date picker that returns DD/MM/YY instead of MM/DD/YY?