2014-12-03 49 views
1

我已經看到了一個自定義插件的奇怪行爲。它的皮膚生成一些HTML,它工作正常。只要我把這個小部件放到頁面上,它只會在頁面刷新後纔可見。當我嘗試將小部件拖到另一個位置時也是如此。Impresspages Widget在拖放後消失

有沒有人遇到同樣的問題?我不確定它是一個錯誤還是我可能會錯過我的代碼中的某些東西。

[編輯]沒有與ipContent(問題) - > getCurrentPage() - >的getId(),它是在執行任何拖放動作後NULL [編輯]

這是我的皮膚文件:

<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> 

在此先感謝。

回答

1

當您重新加載頁面時,「currentPage」確實存在。這就是代碼工作的原因。但是,當您拖動一個新的窗口小部件或移動窗口小部件時,會使用AJAX加載內容。 AJAX請求沒有真實頁面。因此,在某些點上無法獲得當前頁面ID在widget的皮膚中。

+0

謝謝,我只是注意到你的評論。 – 2014-12-04 10:27:57