.php help , how do they do it ?

  • Thread starter Thread starter ang3lmigu3l
  • Start date Start date
A

ang3lmigu3l

Guest
Ok there's many site that do this but im using this one as an example.
in createblog.com
they have a url :
"http://www.createblog.com/layouts/ index.php"
where they have all their myspace layouts
but then ".php?page=2" is added at the end of the url for page 2 ,
but the "http://www.createblog.com/layouts/ index.php" doesnt change
how can i do that with my website ?
is installing xampp a good way to start ?
 
You have to learn php. The site is being dynamically generated from a database.

http://www.w3schools.com/php/default.asp
 
I do that a lot for my websites, too. Use something like this:

<?php
$current = $_GET['page'];
include "config.php";
$conn = mysql_connect($host, $user, $pass) or die($error);
mysql_select_db($database) or die($error);
$selectPage = mysql_query("SELECT pageData FROM pages WHERE pageReference='$current'");
while($information = mysql_fetch_array($selectPage,MYSQL_ASSOC))
{
eval($information['pageData']);
}
?>

Simplistic, but it will work. For this, you need an SQL database with a table in it called "pages," that has two columns in it: one is a VARCHAR[255] called pageReference, and another is a TEXT called pageData. Then, you put the page data (in PHP) in the text area for each row, then insert what you want the page reference to be (in ...php?page=2, it would be "2") in the pageReference, then submit. Then, when the page is called that has the page="..." the program will search the database for the pageReference of "..." and pull out the php code and execute it.

Sorry if that's a bit confusing.

EDIT: the database information is, obviously, not set in stone; you can change the names and data types to whatever you want in order to fulfill the needs better, but remember to change them both in the database and in the code.

P.S. - if this is confusing, though, I recommend you learn some more about PHP, otherwise you won't be able to effectively use this.
 
Back
Top