I want to create my site using PHP...
Currently i am using javascript to create my site... but i think PHP is easy to use and easy to update...
i also see some topics about PHP through google search but i m not satisfied because i want to create a dynamic site like index.php?id="mypagename"
i want to put all my pages into one page(index.php) and access through id="mypagename"
For Example: i want to create to catagory first is Wallpapers and second is Videos.
In Wallpapapers.php i want put all of my wallpapers and in video.php all videos.
Please Suggest me how to do this?
Thanks for any Help!
You were creating a site in java? That doesn't sound fun at all.
The best advice is start looking at tutorials and books. If your content is mostly static though all you need is html/css.
(2012-07-17, 04:49 PM)Alex Smith Wrote: [ -> ]You were creating a site in java? That doesn't sound fun at all.
The best advice is tart looking at tutorials and books. If your content is mostly static though all you need is html/css.
Thanks but i says Java Script not Java...
To get information like that you would do something like this in your PHP file:
<?php
$id = $_GET['id'];
//do some validation
if ($id == 1) {
//output page 1
echo "hi!";
}
?>
Then anything after "index.php?id=" would be assigned to $_GET['id'] and thus $id
(2012-07-17, 05:01 PM)Tom K. Wrote: [ -> ]To get information like that you would do something like this in your PHP file:
<?php
$id = $_GET['id'];
//do some validation
if ($id == 1) {
//output page 1
echo "hi!";
}
?>
Then anything after "index.php?id=" would be assigned to $_GET['id'] and thus $id
Thanks! information is helpful but i need more help...
Can you create 2 pages for me using id?
index.php?id=wall
insert two images
index.php?id=vid
insert two images
Then i will be understand how do i create pages using id's
I still don't see why you're using php. Just because ?id=blay is in the url doesn't mean your going to have a cms. Until you understand to how to at least do this much on your own (because this like the basics of the basics) you should stick with html.
(2012-07-17, 05:16 PM)Alex Smith Wrote: [ -> ]I still don't see why you're using php. Just because ?id=blay is in the url doesn't mean your going to have a cms. Until you understand to how to at least do this much on your own (because this like the basics of the basics) you should stick with html.
He is better off trying this things right now if he wants to learn at some point. You shouldn't stick to HTML just because it is easiest.
He can close the php tag and paste its code there anyways, no need to fully use HTML when you can use basic PHP stuff.
If I understand your question, you would do something like:
<?php
$id = $_GET['id'];
//do some validation
if ($id == 'wall') {
//output page 1
echo "wall!";
} elseif($id == 'vid')
{
//output page 2
echo "vids!";
} else {
//this is outputted if no ID is given
echo "Oops, no ID specified!";
}
?>