大家好,我想将我的js代码从我的phtml页面移动到js页面,我想将该页面调用到我的phtml页面中。而且我正在zend工作。
任何人都可以帮助我。
这是我的phtml代码:
<div class="reminderForm">
<form id="reminderForm_<?php echo $this->ticketId;?>">
<h4><?php echo $this->translate('set_reminder'); ?></h4>
<span class="formz-required">*</span>
<?php echo $this->form->remark;?>
<?php if ($this->isAllowed('ticket.index.reminder-type')) : ?>
<span class="remark-element-span formz-required">*</span>
<?php echo $this->form->reminderType;
endif; ?>
<span class="remark-element-span formz-required">*</span>
<?php
echo $this->form->reopenTicket;
echo $this->form->ticketId;
?>
<div class="button-block">
<span><?php echo $this->form->cancel; ?></span>
<span><?php echo $this->form->save; ?></span>
</div>
</form>
</div>
<?php
echo $this->inlineScript()->appendScript(<<<EOS
$(".reopenTicket").datetimepicker({
showOn: "button",
buttonImage: "/themes/bas/icons/fatcow/16x16/calendar.png",
dateFormat:'dd-mm-yy',
timeFormat: 'HH:mm',
buttonImageOnly: true,
controlType: 'select',
showWeek: true,
firstDay: 1,
oneLine : true
});
var today = new Date();
var tomorrow = new Date();
tomorrow.setDate(today.getDate()+1);
tomorrow.setHours(8);
tomorrow.setMinutes(0);
$(".reopenTicket").datetimepicker("setDate", new Date(tomorrow));
EOS
);
?>
这是我的js文件:
var REMINDER = {};
REMINDER.Followupreminder = {
};
在其中
REMINDER.Followupreminder = {
};
我想调用该js代码的功能。
任何人都可以帮助我。 预先感谢。
答案 0 :(得分:1)
一旦您提供了其他信息(初始请求不在上下文中),这与您的示例类似:
var REMINDER = {};
REMINDER.Followupreminder = {
init: function(){
// put your any initialization here
this.bindUI();
},
bindUI: function(){
// if bindUI isn't being used from outside - you may call this.initDatePicker() directly from init()
this.initDatePicker();
},
initDatePicker: function () {
console.log('Congratulations! Your code has been moved and executed!');
$(".reopenTicket").datetimepicker({
showOn: "button",
buttonImage: "/themes/bas/icons/fatcow/16x16/calendar.png",
dateFormat: 'dd-mm-yy',
timeFormat: 'HH:mm',
buttonImageOnly: true,
controlType: 'select',
showWeek: true,
firstDay: 1,
oneLine: true
});
var today = new Date();
var tomorrow = new Date();
tomorrow.setDate(today.getDate() + 1);
tomorrow.setHours(8);
tomorrow.setMinutes(0);
$(".reopenTicket").datetimepicker("setDate", new Date(tomorrow));
}
};
$(function(){
REMINDER.Followupreminder.init();
});