thepocketgeek
02-08-2006, 08:53 PM
Ok. Let's say that I was working on simple two page site. The first page will simply have a drop down list that offers the following options:
The New York Yankees
The New York Mets
The New York Knicks
The Adelaide Crows
The Collingwood Magpies
Once the user selects a team and clicks submit, the second page loads and I would like to have the header image of that page reflect which team the user selected and also have an intro paragraph that is specific to the team.
I already know how to pass a variable from one page to another but I am looking to avoid making five or six separate pages for each of the options. If I wanted to add another page, for team news, record or rosters for instance, I would rather prepare a single page and have the selected team from the first page dictate what information is shown.
I have been reading up on sessions in PHP and looking at perhaps using XML for my datasource or setting up a table in mySQL to store the data. My question is what would be the best way to approach this problem? I started trying to piece together some pseudocode to help me through it and this is what I came up with:
if ($team == 'yankees') {
// This is the header image I would swap out.
$header_image = 'images/yankee_header.jpg';
// This would be the text I would need to swap out.
$team_text = 'The New York Yankees play in the Bronx at Yankee Stadium';
} else if ($team == 'mets'){
$header_image = 'images/mets_header.jpg';
$team_text = 'The New York Mets play in Queens at Shea Stadium';
} else if ($team == 'kicks'){
$header_image = 'images/knicks_header.jpg';
$team_text = 'The New York Knicks play in Manhattan at Madison Square Garden.';
}
} else if ($team == 'crows'){
$header_image = 'images/crows_header.jpg';
$team_text = 'The Adelaide Crows play in Australia and thats pretty freakin sweet!';
}
} else if ($team == 'magpies'){
$header_image = 'images/magpies_header.jpg';
$team_text = 'The Collingwood Magpies play in Australia and they are my favorite team.';
}
I was even looking at using Dreamweaver's templates to help me in streamlining the pages as well. I was thinking I could place the sorting script in the template and the editable regions would be where I could call the variables for the specified team.
If using mySQL is the best way to approach storing the images, how do I load them into the tables. The only information that I found on the web thus far had to do with dynamically creating graphs using PHP (cool in and of itself but not what I was looking for...)
If XML is the way to go, what are the steps involved in pulling data in using PHP? Most of my PHP work thusfar has involved mail forms and simple posting to tables in mySQL.
You guys are the best of the best so any suggestions would be greatly appreciated.
Go Magpies!
The New York Yankees
The New York Mets
The New York Knicks
The Adelaide Crows
The Collingwood Magpies
Once the user selects a team and clicks submit, the second page loads and I would like to have the header image of that page reflect which team the user selected and also have an intro paragraph that is specific to the team.
I already know how to pass a variable from one page to another but I am looking to avoid making five or six separate pages for each of the options. If I wanted to add another page, for team news, record or rosters for instance, I would rather prepare a single page and have the selected team from the first page dictate what information is shown.
I have been reading up on sessions in PHP and looking at perhaps using XML for my datasource or setting up a table in mySQL to store the data. My question is what would be the best way to approach this problem? I started trying to piece together some pseudocode to help me through it and this is what I came up with:
if ($team == 'yankees') {
// This is the header image I would swap out.
$header_image = 'images/yankee_header.jpg';
// This would be the text I would need to swap out.
$team_text = 'The New York Yankees play in the Bronx at Yankee Stadium';
} else if ($team == 'mets'){
$header_image = 'images/mets_header.jpg';
$team_text = 'The New York Mets play in Queens at Shea Stadium';
} else if ($team == 'kicks'){
$header_image = 'images/knicks_header.jpg';
$team_text = 'The New York Knicks play in Manhattan at Madison Square Garden.';
}
} else if ($team == 'crows'){
$header_image = 'images/crows_header.jpg';
$team_text = 'The Adelaide Crows play in Australia and thats pretty freakin sweet!';
}
} else if ($team == 'magpies'){
$header_image = 'images/magpies_header.jpg';
$team_text = 'The Collingwood Magpies play in Australia and they are my favorite team.';
}
I was even looking at using Dreamweaver's templates to help me in streamlining the pages as well. I was thinking I could place the sorting script in the template and the editable regions would be where I could call the variables for the specified team.
If using mySQL is the best way to approach storing the images, how do I load them into the tables. The only information that I found on the web thus far had to do with dynamically creating graphs using PHP (cool in and of itself but not what I was looking for...)
If XML is the way to go, what are the steps involved in pulling data in using PHP? Most of my PHP work thusfar has involved mail forms and simple posting to tables in mySQL.
You guys are the best of the best so any suggestions would be greatly appreciated.
Go Magpies!