Question

i need to make a login system for my school job, and i want my url on address bar before login and after still the same. Just like facebook, there is url : facebook.com if we're not logged in, and there will be stil facebook.com if we're logged in.

No correct solution

OTHER TIPS

Use HTML5 history API, jQuery,

refer this code examples

example

People use backbone for a one-page app generally. I assume you are using an authentication library or an authentication system of your own in CodeIgniter. Inside your default controller you should do something like this (the algorithm)

If user is logged in:
  call the layout for the login system
else:
  call the main page to be displayed when the user is logged in

For adding other information/pages to it, you could use jquery to replace the body text with the new page.

Where is the new page called from? It can be called from valid CodeIgniter Controllers which provide only the body html.

For example, in your main layout, you could use:

$(document).ready(function(){
  $('#button1').click(function(){
    $.get("mysite.com/second_page",function(data,status){
    $('#main_div').html(data);
    });
  });
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top