page?id=link

How would I just change certain bits on a page…?

My pages are all the same, so I only want to change the stuff in the main content box on my site.

[code]<?php

if (!isset($_GET[‘type’]))
{

##main page##
}

else if ( $type == ‘page1’ )
{
##content 1##
}

else if ( $type == ‘page2’ )
{
##content 2##
}

else if ( $type == ‘page3’ )
{
##content 3##
} else {
header(‘location: http://www.website.com’);
}

?>[/code]

So how would I have it to that in my main page I have something like ‘$content’

and then later on it defines the content ‘$content = CONTENT HERE = main?type=page1’

Thanks.

I think you are having a little bit of a misunderstanding. You are checking if the $_GET[‘type’] is set but later you are trying to access it with $type. With register_globals = OFF you should always refer to the variable with the $_GET[‘type’]…
unless you move it into a working variable (Ex: $type = $_GET[‘type’])
then you can access it with just $type.

:o

That my explain it a bit, when I go to " main.php?type=1 " I want it load up the content of 1 in the grey box, kinda like HTML frames. Cept I want it in 1 PHP file.

[code]main.php:

echo "

mainn";
$content
echo " bottomn";

if $content = ‘main.php?type=1’ then…

echo "

this content #1 n";

else if $content ‘main.php?type=2’ then…

echo "

this content #2 n";

ETC ETC[/code]

That isn’t PHP above, but I think you can get the idea.

so main.php?type=1 would make:

main
content #1
bottom

Ok, lets say you have a link that looks like:

www.mysite.com/storylistings.php?type=sports

Now when you access the page you should have something says:

[php]<?
$type = $_GET[‘type’];

if(!isset($type)){
$content = “main content here”;
}
elseif($type == “page1”){
$content = “page 1 content here”;
}
//so on and so forth…
?>[/php]

Then just echo out content where it needs to be. That should get you what you need.

Your still not getting it, but I suppose i’m not explaining it right.

Here is my website, now, the only thing that changes between the pages in the middles bit, so when I go to ‘index.php?type=profile’ I only want it to change the middle bit to the profile, instead of loading the whole page, so what I want is kinda html Iframes, cept I don’t want to use HTML frames.

So would I have to something like ‘$content’ in the middle of the index main page, then in the php define what that content is?

Sponsor our Newsletter | Privacy Policy | Terms of Service