View Full Version : not sure what to call this :-x
chasebadkids
September 14th, 2005, 08:31 PM
Sorry about the title i relaly couldnt think of what to call it,
anyways what im trying to do is have a page, that has a bunch of css files, filled with codes, theres a dropdown list, they click the title they want to preview, and itll load that css list, as well as change some content in the top table like the link to get the css code, the title of the layout, the layout creators credit, etc etc.
So what would the easiest way be for going about this, I have over 100 "laouyts" (or css codes) that I want to have used, so I do I have ot make 100 different pages, or is it a nice php script to make it easy, or what. Thanks guys.
This is a good example of what I want: http://myspace.nuclearcentury.com/
bwh2
September 14th, 2005, 08:44 PM
look at how they use php to load the variables in the address.
chasebadkids
September 14th, 2005, 09:09 PM
Ok, I noticed that whatever form you picked the name was in the address, but I dont get it still, im sorry man please help, by teh way www.chasebadkids.net
is my site
chasebadkids
September 14th, 2005, 09:10 PM
Ok, I noticed that whatever form you picked the name was in the address, but I dont get it still, im sorry man please help, by teh way www.chasebadkids.net
is my site
bwh2
September 14th, 2005, 10:02 PM
address looks like this:
http://myspace.nuclearcentury.com/layouts/free/simple.php?Layout=Fight_Club_Soap
Layout is the variable. Fight_Club_Soap is the value of the variable. this variable will be loaded into the php like this:
<style type="text/css" media="screen">@import url(css/<?php print $Layout; ?>.css );</style>
so when the server parses the php and turns it into html, the html looks looks like this:
<style type="text/css" media="screen">@import url(css/Fight_Club_Soap.css );</style>
thus, the style is changed based on one variable which points to a different stylesheet.
Ankou
September 14th, 2005, 10:23 PM
And going along with what bwh2 is telling you, you could work with a database to store all the needed info for the CSS file, title, creator credits, link to download, etc.
You actually probably wouldn't need to store too much depending on how you set it up. If you assign each CSS an ID, store the info that relates to that file and when a user selects the ID, you call up the information from the database and output it as needed.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<?php
if(!isset($_POST["id"])){
$id = 0;
}else{
$id = $_POST["id"];
}
/*
Grab your information from a database, external file
or another method.... I'm just using arrays for this
example.
*/
$title = array("CSS Blue", "CSS Green", "CSS Red");
$author = array("John Doe", "Jane Smith", "Chuck Wagon");
$creator_credits = array("Credits for John Doe", "Credits for Jane Smith", "Credits for Chuck Wagon");
echo "
<link rel=\"stylesheet\" type=\"text/css\" href=\"$id.css\" />
<title>$title[$id] - $author[$id]</title>
</head>
<body>
<h1>$title[$id] - $author[$id]</h1>
<p>$creator_credits[$id]</p>
"
?>
<br /><br />
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">
<select name="id">
<option value="0">CSS Blue</option>
<option value="1">CSS Green</option>
<option value="2">CSS Red</option>
</select>
<input type="submit" value="Submit" />
</form>
</body>
</html>
chasebadkids
September 15th, 2005, 01:49 AM
Hey, thanks for the quick replies guys,
@ankou
will this script you show me echo or post, or whichever, everything so say they pick "CSS blue" itll show, the name of the layout, the person who contributed it, and it will change a link to get the code for the layout?? can you show me a little more step by step how this breaks down if its not a bother, Im still pretty basic in php but I am a fast learner :-d
bwh2
September 15th, 2005, 08:54 AM
when and if you do elaborate ankou, be sure to use a for loop to echo out the dropdown options.
Ankou
September 15th, 2005, 02:41 PM
The code example I put is just to show you a way to do it. I wouldn't recommend using an array - the only reason I did was so that you had a working example. With 100 some choices you would probably be best off with using a database to hold all the information. Plus it's pretty simple to create a little control panel for yourself to make add, edit and remove choices.
If you look at the code and follow along with what it does you'll notice that it goes something like this....
On the first load of the page $_POST["id"] isn't set so we set $id = 0 -- just our default layout and information. We load the CSS for the page, show in the page title the name of CSS example and the user name. Then in the H1 tag we load the same thing. For the paragraph tag we show the creator credits. I didn't add the link to the download - I forgot about that. But that can be added as well.
Then we show the drop down menu to select the new CSS example. This is where bwh2 was saying to use a loop - which is the right choice. You'll have 100 different examples so it wouldn't make sense to type them all out. And it's also why I was using numbers to handle the id (or you could use a number and some string if you want). The point being it's easier to have something like:
<?php
for($i = 0; $i < 101; $i++){
echo " <option value=\"$i\">CSS $i</option>";
}
?>
Than it would be to type out 100 different options. Of course for the CSS $i in there you could have made a call to the database to grab the actual name of the CSS example and put it there.
When the user hits the submit button you're just recalling the page and getting the new id and fetching all the data to show with the rest of your page information.
For the database I would think you'd only need a few fields...
ID
CSSExampleName
AuthorName
AuthorCredits
DownloadLink
Each ID would be a unique number - could start with 0 and use auto increment in MySQL for that if you'd like.
So it's pretty straight forward, but if you need some more help or an actual example let me know.
chasebadkids
September 15th, 2005, 06:18 PM
The code example I put is just to show you a way to do it. I wouldn't recommend using an array - the only reason I did was so that you had a working example. With 100 some choices you would probably be best off with using a database to hold all the information. Plus it's pretty simple to create a little control panel for yourself to make add, edit and remove choices.
If you look at the code and follow along with what it does you'll notice that it goes something like this....
On the first load of the page $_POST["id"] isn't set so we set $id = 0 -- just our default layout and information. We load the CSS for the page, show in the page title the name of CSS example and the user name. Then in the H1 tag we load the same thing. For the paragraph tag we show the creator credits. I didn't add the link to the download - I forgot about that. But that can be added as well.
Then we show the drop down menu to select the new CSS example. This is where bwh2 was saying to use a loop - which is the right choice. You'll have 100 different examples so it wouldn't make sense to type them all out. And it's also why I was using numbers to handle the id (or you could use a number and some string if you want). The point being it's easier to have something like:
<?php
for($i = 0; $i < 101; $i++){
echo " <option value=\"$i\">CSS $i</option>";
}
?>
Than it would be to type out 100 different options. Of course for the CSS $i in there you could have made a call to the database to grab the actual name of the CSS example and put it there.
When the user hits the submit button you're just recalling the page and getting the new id and fetching all the data to show with the rest of your page information.
For the database I would think you'd only need a few fields...
ID
CSSExampleName
AuthorName
AuthorCredits
DownloadLink
Each ID would be a unique number - could start with 0 and use auto increment in MySQL for that if you'd like.
So it's pretty straight forward, but if you need some more help or an actual example let me know.
Im gonig to attempt to do that but coudl just just make me an example please, or even just show me the car one you made and I should understand it, thanks so much for your time man.
chasebadkids
September 15th, 2005, 06:20 PM
also, if you could, show me or make me a way so that people can deposit their own layouts and have it upload right into the server but mabye with like my permission , like I validate it, If you have paypal or something id be willing to send some money to you, thanks for your time. greatly appreciatedd :hugegrin:
Ankou
September 15th, 2005, 09:08 PM
I sent you a private message with my email so you can contact me about this.
hl
September 15th, 2005, 10:35 PM
and I IMed you :)
chasebadkids
September 16th, 2005, 03:49 PM
thanks for the help / quick responses guys, I got harish hel;ping me out on this one via aim, but if I get stuck Ill be here :-d
chasebadkids
September 20th, 2005, 06:20 PM
Hey guys just wante4d to warn you, if harish says that he will help you, dont expect it from him, he wanted money from me, I sent it to him Via paypal, its been over a week and I havent seen or heard from him at all, Ankuo on the other hand has been a great help so far. Just watch out for harish and his scheming
hl
September 20th, 2005, 08:00 PM
Hey guys just wante4d to warn you, if harish says that he will help you, dont expect it from him, he wanted money from me, I sent it to him Via paypal, its been over a week and I havent seen or heard from him at all, Ankuo on the other hand has been a great help so far. Just watch out for harish and his scheming
lol dude. all i need is an email to send it to.
besides, i didn't even expect the the upfront payment.
chasebadkids
September 21st, 2005, 01:01 AM
Oh sure, I post 1 thread in a forum and boom you reply, I sent you the email multiple times.
itbekrischase
gmail.com
@ between chase and gmail
NANO3
December 1st, 2005, 01:22 AM
Oh sure, I post 1 thread in a forum and boom you reply, I sent you the email multiple times.
itbekrischase
gmail.com
@ between chase and gmail
you should be ashamed of your accusations, we designers and coders have LIVES, we are not SLAVES that are at your service 24/7
you webmasters need to understand this.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.