我见过一个定制插件的奇怪行为。它的皮肤生成一些html,它工作得很好。当我将小部件放到页面上时,只有在页面刷新后才能看到。当我试图将小部件拖到另一个位置时,情况也是如此。
有没有人经历过同样的问题?我不确定这是一个bug,还是我可能遗漏了代码中的某些内容。
编辑 ipContent()->getCurrentPage()->getId()有一个问题,执行任何拖放操作后->getId()都是空的编辑
这是我的皮肤档案:
<div>
<div class="form-group">
<div class="checkbox">
<label>
<input id="auth-email-check-nutzung" type="checkbox"><?php echo ipSlot('text', array(
'id' => 'nutzungsbedingungen_' . ipContent()->getCurrentPage()->getId(),
'default' => 'Ich stimme den <a href="#">Nutzungebedingungen</a> zu.',
'attributes' => array(
'id' => 'auth-email-check-nutzung-text'
)
)); ?>
</label>
</div>
<div class="checkbox">
<label>
<input id="auth-email-check-daten" type="checkbox"><?php echo ipSlot('text', array(
'id' => 'datenschutz' . ipContent()->getCurrentPage()->getId(),
'default' => 'Ich stimme der <a href="#">Datenschutzerklärung</a> zu.',
'attributes' => array(
'id' => 'auth-email-check-daten-text'
)
)); ?>
</label>
</div>
</div>
<form class="form" role="form">
<div class="form-group">
<label for="inputEmail1" class="control-label">Email</label>
<input type="email" class="form-control" id="inputEmail1" placeholder="Email">
</div>
<div class="form-group">
<?php if ((ipIsManagementState())) :?>
<?php
// Use a simulated Button to edit text and prevent any default button event
// for user friendly inline editing
echo ipSlot('text', array(
'id' => 'button' . ipContent()->getCurrentPage()->getId(),
'default' => 'senden',
'tag' => "div",
'class' => 'btn btn-danger auth-button btn-block',
'attributes' => array(
'data-target' => 'bs-button',
'id' => 'auth-email-button-div'
)
)); ?>
<?php endif; ?>
<?php if (!(ipIsManagementState())) :?>
<?php
// Display real Button only on the live page with the contents of ipSlot :
// 'id' => 'button' . ipContent()->getCurrentPage()->getId()
echo ipSlot('text',array(
'id' => 'button' . ipContent()->getCurrentPage()->getId(),
'tag' => "button",
'class' => 'btn btn-danger btn-block',
'attributes' => array(
'data-target' => 'bs-button',
'id' => 'auth-email-button',
'disabled' => 'disabled'
)
)); ?>
<?php endif; ?>
</div>
</form>
</div>提前谢谢。
发布于 2014-12-04 09:14:41
当您重新加载页面时,"currentPage“确实存在。这就是为什么代码有效的原因。但是,当拖动新小部件或移动小部件时,它的内容将使用AJAX加载。AJAX请求没有真正的页面。因此,在小部件的外观中获取当前页面id在某些方面是不可能的。
https://stackoverflow.com/questions/27268547
复制相似问题