Friday 16 September 2011

Hi! im creating a website....index.php must handle all the pages?

Hi! im creating a website....index.php must handle all the pages, like ?view=subindex.php and such to display the pages without changing to css or main GUI..my problem is how do i show it when it is clicked?and where to i put the page to be called in the index.php file, or should i use a %26lt;div%26gt; or inlcude ' file.php'?please help me!thanks...Hi! im creating a website....index.php must handle all the pages?You could do so, but it is not necessary. Actually it is not a good practice either.
Hi! im creating a website....index.php must handle all the pages?
Buddy try w3schools.com php tutorial
Hi! im creating a website....index.php must handle all the pages?
http://www.besthostlead.com



All you have to do is to do something like this with the link : %26lt;a href=%26quot;index.php?view=subindex%26quot;'%26gt; The name of lthe link enters here%26lt;/a%26gt;



The nest step is to use the php GET method to receiove it. Try this :



if(isset($_GET['view']))

{



$view = $_GET['view'];



if($view=='subindex')

{



echo %26quot;This is the subindex page%26quot;;



}





}





Do the same thing for all the links, just change the name of the view...for example view = contactus.



Good luck
not quite sure what you're wanting

1. index.php does not technically have to handle all of the pages

2. I believe you are looking for $_GET['view'] (in your example it would return 'subindex.php')

3. If you want index.php to handle all the pages then yes do 'include file.php'



Example index.php

%26lt;?php

//was a specific page requested?

if(isset($_GET['view'])){

$page = $_GET['view'];

}

else{

//default page

$page = 'homepage';

}

include_once $page;

?%26gt;



Edit: Definitely do not do it afamguy's way... having all the files in one massive php file is a bad approach, not only will it making editing harder, but php must interpret that entire file each time its accessed
use div tags to set changes in url next to index page and also get more study about html and css scripting..
  • ie hosted control
  • multiple tables
  •