Jump to content

Your Professional Advice Please


justlukeyou

Recommended Posts

Hi,

 

I am an amateur PHP programmer but I am learning all the time(some would argue). My site will have 3 user groups and I originally planned to have 3 different tables, 1 for each user group. The navigation of my site would be based on set links making the navigation easy. However as a number of people have pointed out I should use one table which I have now adopted. This however creates a problem with the navigation.

 

The best solution I can think of is to echo the user type (which I am collecting) into the link.

 

For example:

 

(current link)  www.website.com/profiles/xboxprofile.php - I would then echo all the content based on Xbox designed profile

 

(new link) www.website.com/profiles/<php echo $usertype; ?>profile.php

 

The thing I haven't used this process before.

 

The only other method I can think is to use lots of if statements and echo different designs onto the page however this sounds very complicated and more time consuming to set up.

 

Any suggestions please from professional programmers?

Link to comment
Share on other sites

Not really sure how you plan on programming the profile page(s) but both methods I'm thinking of are horrible.

 

Your link should only be website.com/profile.php, or similar. Assuming you don't need to be logged in to view a profile you can append what's known as a query string to your URL as follows: website.com/profile.php?user=MyUsername and query your database for the users details.

 

A brief explanation on query strings:

  • ? denotes the beginning of the query string.
  • user is the variable name and MyUsername is the value.
  • the value can be retrieved in your code using the special $_GET super global i.e. $_GET['user'];
  • You can have multiple variables using this syntax: website.com/profile.php?user=MyUser&variable2=someValue&anotherVariable=somethingElse

By using the $_GET variable you can query your database for whoever you want thereby creating a single php script. This is the basis of php: its a language used to create dynamic pages amongst other things.

Edited by CPD
Link to comment
Share on other sites

You're missing the point of what PHP can do by thinking about sites in terms of pages. You should be thinking about templates that are rendered and filled with information based on an incoming request.

 

In other words, if I type in:

 

www.example.com/profile/kevinm1/xbox

 

Your system should be able to look up my Xbox related info and then display it in a Xbox profile template. I'm not sure how your back end/database is designed, but you should be able to pull all that info with one query.

 

Can you show us how your db is structured?

Link to comment
Share on other sites

Hi,

 

I will be using a template but I plan to use 3. One for each user group. For example the Xbox one will feature the official Twitter feed. The Playstation will feature the official Playstation feed etc. However with this it makes the navigation harder.

 

If I had just one profile I can just echo the users data onto the one profile page. But using 3 profile pages makes the navigation harder.

 

For example if the user logs on to the homepage and they want to view their profile how can I determine what of the 3 profile templates it will be. Like I say the simplest method seems to be to echo the user type into the link.

Link to comment
Share on other sites

The problem isn't one of navigation but of design. What do you think the user should see when they look at their generalized (not console specific) profile? All of their data? A few key stats with link to their console specific profiles? Default to a particular console profile?

 

We can't give a definitive answer because there isn't one. Without knowing your app design from top to bottom, we're shooting in the dark. It depends on how you want the flow to go as it relates to the rest of your site. You need to mock up the process, either with actual HTML pages, a storyboard (Indigo Studio is a free storyboard and wireframe tool), or, hell, a notebook or index cards. Walk through it and ask others to walk through it.

 

Once you figure that out, the actual code will be fairly simple.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.