Hello Friends, i have 10 php files, in all files i need to include header, menu, footer. Currently, am writing include tags in all 10 pages, but is there any way to get header, menu, footer automatically with out including in every page. Like if we include in one baseLayout.php every php file must follows that, like Tiles concept in Struts.
You can have one php file, include each file once, change the content with each statement. like this: <? include 'header.php' ; include 'menu.php' ; ?> <?if ($_GET['page']=='home'){?> display html content <?}else if ($_GET['page']=='anotherapage'){?> display html content <?}?> ... <? include 'footer.php' ;?> Code (markup): and then just modify the url for each page like this yourdomain.com?page=yourpagename hope it helps
also if you don't want anyone to be able to see your variable get function too easily try the re-write function in your htaccess file to change the url from yourdomain.com?page=yourpagename to yourdomain.com/page/yourpagename
great i'm glad it helped! I didn't mention it before but I have noticed an increase in indexed pages on google when my url has been re-written with the rewrite function.
can any one of you, give me a small example Let i have a,php , b.php, and header.php, footer.php, and main.php... in main.php <? include 'header.php' ?> <?if ($_GET['page']=='a'){?> display html content <?}else if ($_GET['page']=='b'){?> display html content <?}?> ... <? include 'footer.php' ;?> PHP: how can i give the url in the address bar....!!!!, am not clear about this guys. you mean may i give... yourdomain.com/main.php?page=yourpagename or... ?