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
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.

Link to comment
Share on other sites

<?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
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.