Login before and after navigation bar processing 2015-12-12

Source: Internet
Author: User
Note: Add gray background, about the value of Ajax , and JS judgment

1 post-Login controller processing: Determine whether to log in and transmit user information

classIndexcontrollerextendsHomebasecontroller {//Login Publicfunctionindex () {$id=i ("Get.id"); $users _model=m ("Users"); $user=$users _model->where (Array("id" =$id)),find (); if(Empty($user)){            $this->error ("Look no man!") "); }        $this->assign ($user); $this->display (": Index"); }    functionIs_login () {if(Sp_is_user_login ()) { $this,AjaxReturn (array("status" =>1, "user" = Sp_get_current_user ())); }Else{            $this-AjaxReturn (Array("Status" =>0, "info" = "This user is not logged in!") ")); }    }
。。。。。。

2 Landing and not logged-in display of the home navigation bar before and after landing

<DivID= "Main-menu-user">
   
 <Divclass= ' Useroutuser '><ulclass= "Nav navbar-nav navbar-right"><Li><ahref= "{: U (' User/register/index ')}"Data-toggle= "Dropdown">Registered
  a>
   Li>
    ul><ulclass= "Nav navbar-nav navbar-right"><Li><ahref= "{: U (' User/login/index ')}"Data-toggle= "Dropdown">Landing
     a>
      Li>
       ul><ulclass= "Nav navbar-nav navbar-right"style= "margin-top:10px"><Li><imgsrc= "__tmpl__/public/img/headicon.png"class= "Headicon"/>
        Li>
         ul>
          Div>
             <Divclass= "Userlogin user"><ulclass= "Nav navbar-nav navbar-right"><Li><ahref= "{: U (' user/index/logout ')}"Data-toggle= "Dropdown">Exit
           a>
            Li>
             ul><ulclass= "Nav navbar-nav navbar-right"><Li><ahref= "{: U (' User/center/index ')}"Data-toggle= "Dropdown"class= "User-nicename"> 
                a >  
                 li> 
                  ul><ul  class  = "nav navbar-nav navbar-right"  style= "margin-top:10px">  <Li  ><img  src= ""  Class  = "Headicon"/> 
                   li> 
                    ul >  
                     div> 
                      div>       

3 after landing, JS to the box operation

The above describes the landing before and after the navigation bar processing 2015-12-12, including the content of Ajax, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.