Web Hosting Talk







View Full Version : How to: layouts/?template=1


TDNet
03-12-2005, 06:00 PM
How can I get like a full URL (http://sitename.com/page.php?item=1) to be displayed as http://sitename/?page=1 or something similair?

Informity
03-13-2005, 02:25 PM
by renaming page.php to index.php? :D

or look into mod_rewrite if you're using apache

Hjalmar
03-13-2005, 03:45 PM
<?
function checkPage($page) {
//Controle
if($page=="index") return false;
$page.=".php";
return file_exists($page);
}


$pagina=$_GET['pagina'];

if(!isset($pagina) || empty($pagina)) $pagina="index";

if(checkPage($pagina)) include($pagina.".php");

?>

This page you rename to index_name.php

You put in the index.php file the follow:

<?PHP include "index_name.php"; ?>

You include now the index_name.php file.

You put also in the index file the follow text at the place where you hold a link.

<a href="index.php?pagina=home">

home is the page home.php when you change this in contact you open the page contact.php!

But in the adressbalk you see: http://www.yourlink.com/index.php?pagina=contact

And just like Informity said, you have to change the name page.php to index.php this page will opend himself when you type this like: http://www.yourlink.com

when you would like no page.php/index.php?
you have to fill in the follow:

[code]<a href="?pagina=home">

I hope you mean this?
Good luck!

Edit: Typo