1

我有一个输出具有不同 ID 的链接的代码。单击时,我会将他的 ID 发送到 PHP,以显示此 ID 的子页面。但我想用 PageSlide 加载它们(子页面链接)这里是代码。HTML

<a id="m1" class="leftPanel"></a>
<a id="m2" class="leftPanel"></a>
<a id="m3" class="leftPanel"></a>

JS

<script>

 $('.leftPanel').click(function(event){
    event.preventDefault();
    var page_id = $(this).attr('id');
    var dataString = 'page_id=' + page_id + '&page=load_page';
    $.ajax({
            type: "POST",
            url: "<?php echo $tools_url ?>",
            data: dataString,
            success: function(response){
                $('#here').html(response);
                $('.leftPanel').pageslide({ direction: "left" , modal:true});
            }
     });
 });
</script>

PHP

 if(isset($_POST["page"]) && !empty($_POST["page"]))
{

      $m_id    = ($_POST["page_id"]);
      $page_id = substr($m_id, 1); //<--substing the letter 'm' to take the number only
      $th      = Loader::helper('text');
      $nh = Loader::helper('navigation');
      Loader::model('page_list');
      $pl      = new PageList();
      // Available Filters
      $pl->ignorePermissions(); // Don't check the permissions of the logged-in user.
      $pl->ignoreAliases(); // Ignore aliased pages.
      $pl->filterByParentID($page_id); //Filters by the parent ID.
      // Sorting Options
      $pl->sortByDisplayOrder(); //Orders by sitemap display order ascending.

      // Get the page List Results 
      $pages   = $pl->getPage();
      echo '<div id="modal">';
      foreach ($pages as $page) {
           $title  = $th->entities($page->getCollectionName());
           $url  = $nh->getLinkToCollection($page);
         echo '<a href="'.$url.'">'.$title.'</a>'; 
  }
  echo'<a href="javascript:$.pageslide.close()">Close</a></div>';

}else{
    echo 'No page found!';
}

这是工作它返回我这个 id 页面链接的子页面。但是页面幻灯片不会在第一次点击时触发。有什么建议么??

4

0 回答 0