Click to See Complete Forum and Search --> : [RESOLVED] linking question


davidjmorin
January 22nd, 2008, 04:36 PM
how do i get it so that my url reads like so:
mysite.com/index.php?=home

instead of mysite.com/home.php etc

or what is that type of linking called so that i may google the help

thanks

PeejAvery
January 22nd, 2008, 05:07 PM
First off, why would you want to do that? It creates more work. I can understand if you have dynamic content from a CMS or article system, but not for a standard website.

All that does is create an mediator PHP file which will read from another file or database as to the contents.

<?php
$page = $_GET['page'];

// from database
$sql = mysql_query("SELECT * FROM table WHERE id = '" . $page . "'");
$row = mysql_fetch_object($sql);
echo $row->contents;

// or from another page
$contents = file_get_contents($page);
echo $contents;
?>

PramodsNair
January 23rd, 2008, 06:42 AM
Dear davidjmorin,

Yes, As our member PeejAvery has said in his answer, this type of linking is suitable for a dynamically driven website. This can be usefull when a server side script dishes out pages with content taken from a backend database. These kind of pages are called Dynamic Pages. CMS Driven Websites, E-Commerce Websites etc are examples. As PeejAvery has stated this kind of linking - where a single page serves the response pages based on the query string variable passed to it - can create a lot of overhead for simple websites.

davidjmorin
January 23rd, 2008, 10:40 AM
guess ill just drop that idea then. Thanks guys for your help.