0

I am making a twitter application using PHP. Please excuse me if this question is elementary. In my application, the initial landing page (index.php) contains code for login/oauth. If the user logs in successfully, should I load a new page altogether or simply echo html that renders the user's profile page. For example: if(login success) { load a file that renders selected user's profile page }

or something like

if(login success) { echo html that renders a profile page. }

RedEye
  • 845
  • 1
  • 9
  • 22

2 Answers2

2

If I understand correctly, you're trying to decide what to show the user once they log in. Rather than think what you should show them, what does the user want to do right away? Why do they use your site? If users want to see their profile right off the bat, then do that. If they want to see feed activity, show them that. To start off, you may want to create a simple page that acknowledges they are logged in and give them their major options. Track what users click and see what that tells you. If the vast majority use feature X immediately, then consider loading feature X first. If the users are all over the map, let them pick what they want to do, record it as a preference in their profile, and load that automatically.

In the end, the best thing to show a user when the log in is the first thing they most want to see. :)

Surreal Dreams
  • 26,055
  • 3
  • 46
  • 61
-1

I'd recommend looking into the use of some sort of PHP MVC framework.

Marvo
  • 17,845
  • 8
  • 50
  • 74
  • Why use a framework? How would a framework help in this context? http://meta.stackexchange.com/questions/104048/is-use-a-framework-a-valid-answer – Nic Sep 08 '11 at 20:29
  • 1
    If you're going to take this method I would recommend one of the following: CodeIgniter: http://codeigniter.com/ -or- CakePHP: http://cakephp.org/ Both of which have pretty good documentation... – Dan Sep 08 '11 at 20:30
  • 1
    An MVC framework separates your concerns, making them more modular and easier to replace should you find a better solution down the road. You can code each piece of functionality independently of how you wire them together for the user's optimal flow. You find later that the user experience isn't so great, you can more easily change things than if you coded some big monolithic thing. – Marvo Sep 08 '11 at 20:59
  • 1
    I would. I would keep each view as simple as possible. Need to display different kind of information? Create another view. (Naturally there may be exceptions to this rule if there's a lot of overlap between views.) A page saying "You've logged in successfully" and a page displaying the last 20 messages you posted on your twitter-like page don't sound very similar, so they'd be different views. (For example.) – Marvo Sep 08 '11 at 21:28
  • ok. Good explanation. I was mixing application logic with view related code. I might as well try building it with CakePHP instead. Thanks again. – RedEye Sep 08 '11 at 21:46