Jump to content

how to display php content page using include


gongpex

Recommended Posts

Hello everyone,

 

since I learn code ignitier I became know something about web page content url,

 

using code ignitier I can use url link like this : localhost/folder/index.php/page and it can display web content well.

 

Usually I create code to display web content on index.php manually (without php framework) like this :

 <?php		$page = $_GET["p"];		$avl = "application_$page.php";		if(!file_exists($avl)|| $page=="" || $page=="application_home.php"){		 include("application_home.php");		 }else{		 include("application_$page.php");		 }?>

and this code when I open on browser address like : localhost/folder/index.php?p=example can be displayed well.

 

but when I tried use code like this :

 <?php		$page = $_SERVER['PHP_SELF'];		$avl = basename($page);		if(!file_exists($avl)|| $avl=="" || $avl=="application_home.php"){		 include("application_home.php");		 }else{		 include("application_$avl.php");		 } 				 ?>

and I type on browser address like this : localhost/folder/index.php/example

 

it will shown the page but page without CSS style.

 

Q : how to create web content that display on index.php, can be displayed well without using url

localhost/folder/index.php?p=example (in short if I using localhost/folder/index.php/example can be displayed well)?

 

please help

 

Thanks

Edited by gong
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...