dongyi3616 2015-05-01 12:44
浏览 28

如何通过标头位置(或之前)传递信息

I have complex problem. I'm using jquery tabs on my Prestashop module. I have following tabs on my plugin page:

enter image description here

Inside every tab I have inputs for my plugin and save button. If I'm on e.g Footer and I will click my save button then page refreshes, save changes and then I'm in my first tab (General) instead of Footer. I found solution for this. After every SAVE I'm using

return header("Location: ".$moduledir.'#'.$tab);

where $tab = 'tabname' and $moduledir = plugin url. Header location protects me before re-submitting the form after F5 page refresh. But it's also not effective because I'm also need to pass some informations after save e.g 'Configuration updated' or some error.

public function Output($tab,$outputmessage=null)
{
    $moduledir = $_SERVER['PHP_SELF'].'?controller=AdminModules&token='.Tools::getAdminTokenLite('AdminModules').'&configure='.$this->name.'&tab_module='.$this->tab.'&module_name='.$this->name;

    if ($tab == null)
    {
        return $this->RenderConfig(); # This method displays my plugin
    }
    else
    {
      # I don't know how to also pass by header location my
      # $outputmessage variable which contains
      # information to display. Normally I would use
      # return $outputmessage.$this->RenderConfig();
      # but then it's always brings me to tab general
      return header("Location: ".$moduledir.'#'.$tab);
    }
}

I know that probably there is a better way to do this but I don't know how. Please guys, give me some tips because I'm stupid right now and have no idea how to solve this.

// EDIT

I think I found solution but for now I'm not 100% sure.

public function Output($tab,$display=null)
{
    $tab = '<script>parent.location.hash = "'.$tab.'";</script>';
    return $tab.$display.$this->RenderConfig();
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥15 cmd cl 0x000007b
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line