douchixu3686 2012-09-02 07:05
浏览 56
已采纳

CodeIgniter处理函数但保留在当前页面上

I have a website layout divided into the multiple partial files. One of them is a view which seats in the sidebar. There is a link in it (Facebook Connect), when I press it, it call a specific function, when it's completed without any errors, i received a blank page.

How to program it, so after processing a function inside another Controller, it will stay at the same url ?

Here is a visual. Imagine that I'am on this url http://localhost/web/blog. Here, on that page, i have a sidebar loaded with a link in it, which once it's pressed it will process a function. The url of this link in the sidebar is http://localhost/web/member/facebook_login. After it's done, it should stay on the same url http://localhost/web/blog instead of /web/member/facebook_login.

Is it possible to do it without using a redirect() function ? So it will stay on the same page whenever you are, if your url is /web/home or web/about-us etc. ?

Thanks in advance guys

  • 写回答

2条回答 默认 最新

  • dsp15140275697 2012-09-04 04:12
    关注

    Why using the HTTP referrer is a bad idea, i just explained in my comment.

    The url of this link in the sidebar is http://localhost/web/member/facebook_login

    Then you should put the URL of the current page into that link, as a parameter:

    http://localhost/web/member/facebook_login?go_back_url={url_of_the_current_page}

    Then, after successful login, you can use the value of the parameter go_back_url to redirect back to the address it contains.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部