Jump to content

pages


1grant1

Recommended Posts

I  don’t know if this is possible but i have pages within pages  but I’m trying to put something in to my webpage that uses its own pages within pages for example- example.com/index.php?page=page2?admin=info that’s what I’m trying to get  how would I put them all together?

Link to comment
Share on other sites

so should this work ...its on page 6

if ($page == "page1"){ 
$a =1; 
$file = 1; 
}elseif ($page == "page2"){ 
$b = 1;
$file = 2;
}elseif ($page == "page3"){
$c = 1;
$file = 3;
}elseif ($page == "page4"){
$d = 1;
$file = 4;
}elseif ($page == "page5"){
$e = 1;
$file = 5;
}elseif ($page == "page6"){
switch($_GET['admin']){
case "admin":
	echo 'Admin Page # '.$_GET['page'];
break;

$f = 1;
$file = 6;
}
}else {
$a = News;
$file = include ('news.news');
}

Link to comment
Share on other sites

well I must be doing somthing wrong becasue it wont show up as anything it just brings me back to the default page

$page = $_GET['page'];
if ($page == "page1"){ 
$a = include ('news.news'); 
$file = News; 
}elseif ($page == "page2"){ 
$b = 2;
$file = include ('iframe_chat.php');
}elseif ($page == "page3"){
$c = 1;
$file = 3;
}elseif ($page == "page4"){
$d = 1;
$file = 4;
}elseif ($page == "page5"){
$e = 1;
$file = 5;
}elseif ($page == "page6"){
             switch($_GET['admin']){
case "admin":
	echo 'Admin Page # '.$_GET['page'];
break;

$f = 1;
$file = 6;
}

}else {
$a = News;
$file = include ('news.news');
}

Link to comment
Share on other sites

You could something like this, naming all your files like page1.php page2.php

 

<?php
$page = $_GET['page'];

if(isset($page)){
$page = "$page.php";

if(file_exists($page)){
include($page);
}else {
echo "page does not exist";
}
}else {
include('index.php');
}
?>

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.