Jump to content

[SOLVED] Php Include complex


ev5unleash

Recommended Posts

Alright, I already have gotten a good Php include script going

 

<?php switch(strtolower($_GET['id']))
{
case "58fhckjhdifehskdjh":
    include("homepage/news.php");
break;
case "ud89fhes9ch02hfdek":
    include("othersites/CC/index.html");
break;
case "49fjdkfodijfldkji":
    include("contact.html");
break;
case "dfjke920doid9vj3d":
    include("smartboardsolution.html");
break;
default:
    include("home.php");
break;
}?>

 

Don't ask why all the cases are the way that they are. Anyway, I want to have the same script as before but I want it so that it will include the informative text and information from the page as if it were (index.php?id=49fjdkfodijfldkji (the contact page)) So that the home.php is basically acting as a template and that one empty part of the page will be changed with what ever page is loaded (empty table page). A page with details of what I want to do http://www1.ev5unleash.com:1212/example.php

Link to comment
https://forums.phpfreaks.com/topic/112441-solved-php-include-complex/
Share on other sites

Where you have written 'I want this part to be filled in with text from another page depending on what id is entered in (ex. index.php?id=contact). So that the contact information will be shown here.' you would simply put in another switch statement based on the id parameter and then include different files like you have in your switch statement above. I'm not sure if this is what you mean because it seems like to easy of a solution but let me know.

<?php 

include('./top.html'); // header

switch(strtolower($_GET['id']))  // 'content'
{
	case "58fhckjhdifehskdjh":
	   include("homepage/news.php");
	break;
	case "ud89fhes9ch02hfdek":
	   include("othersites/CC/index.html");
	break;
	case "49fjdkfodijfldkji":
	    include("contact.html");
	break;
	case "dfjke920doid9vj3d":
	    include("smartboardsolution.html");
	break;
	default:
	    include("page.php");
	break;
}

include('./bottom.html'); // footer
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.