Question about sites that have everything on one page. Like facebook.

Discussion in 'PHP' started by x0x, Apr 3, 2010.

  1. #1
    Some sites like facebook, orkut, gmail etc have got everything on one page. Or one frame and the pages are included with some ajax tricks. The point is the main window never seems to reload. How could I accomplish this? If I could do that, I would be able to implement a chat system to my site since that kind of chat systems only work when the page is not refreshed entirely.

    Right now my script works like this:

    setup.php
    functions1.php
    functions2.php
    normal pages

    a normal page includeds functions2.php which includes functions1.php which includes setup.php

    Would it be hard to make my script work in a similar manner? Google sites are in js but facebook seems to be in php. Here is random facebook URL

    http://www.facebook.com/profile.php?ref=profile&id=1348726257#!/?sk=events

    sk=events - that changes the pages. Do they have everything on one page or is there a system that includes different pages? Ajax?
     
    x0x, Apr 3, 2010 IP
  2. Brandon.Add.On

    Brandon.Add.On Peon

    Messages:
    178
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It's all done via AJAX. Basically have one div (main) and populate it based on the request. There is a PHP framework (NOLOH) for this but you could write your own. http://www.noloh.com Try clicking on the nav links and it's just like facebook and google's.
     
    Brandon.Add.On, Apr 3, 2010 IP
  3. x0x

    x0x Well-Known Member

    Messages:
    510
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #3
    Great. Looks that it can be done without making any major modifications to my script, or maybe not...
     
    x0x, Apr 3, 2010 IP
  4. Programmer2009

    Programmer2009 Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Tried using Mod_rewrite? I believe that'd be able to help you
     
    Programmer2009, Apr 3, 2010 IP
  5. x0x

    x0x Well-Known Member

    Messages:
    510
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #5
    Just checked out Mod_rewrite - new to me! That's very useful as well for playing around with the URL.

    My current script isn't built to work like that. I do have the header and the footer in a separate file, but it's vice versa - the body fail includes the header and footer (they are functions which are called in the body file). My aim is to get my script to work without reloading the header and footer, so that the body changes only. I tried including the header/footer file in the body file. At first it seemed to work, but then I realized that all the get and post variables would be messed up since they are posted to the body file directly, not the header/footer file - a lot of recoding would have to happen.

    Would there be a more simple way to do this? I am willing to pay someone to help me modify my script.
     
    x0x, Apr 4, 2010 IP
  6. asnyder

    asnyder Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hey Brandon, thanks for the mention. As Brandon was saying NOLOH http://www.noloh.com does this automatically for you. We even have a Nodule (NOLOH Module) that allows you to literally drop in place the Module and then just have it populate your Panels while allowing it have a bookmarkable URL. You can see an example here: http://www.noloh.com/NOLOH/Nodules/NavHandler/Example/, click on red, green, blue and refresh whenever you like. Unfortunately, you'll have to use NOLOH, but the many benefits that NOLOH provides allows NOLOH to easily earn it's keep.

    The Nodule I mentioned can be downloaded and it's source and above example source here: http://github.com/noloh/NavHandler/blob/master/Example/index.php, you can also watch a recent NOLOH screencast from the Confoo 2010 web conference here http://vimeo.com/10106797
     
    asnyder, Apr 7, 2010 IP
  7. Cloud Computing Forum

    Cloud Computing Forum Guest

    Messages:
    55
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Hi check out XAJAX framework for PHP if your interested in learning some AJax it's an easy entry point. http://xajaxproject.org/
     
    Cloud Computing Forum, Apr 7, 2010 IP