jquery - Using PHP include to include a file with it's own included file -
i trying load projects.php file higher-level index.php file , want maintain .js .css , further nested (in .js files) .php files, declared in projects.php file.
my index.php file goes like:
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>blst</title> </head> <body> <?php $projectspage = "/tables/php/projects.php"?> <li><a href="index.php?page=<?php echo $projectspage;?>">projects</a></li> <?php if(is_null($_get["page"])) { $page = ""; }else{ $page = $_get["page"]; } include($page); ?> </body> </html>
my projects.php file
<!doctype html public "-//w3c//dtd html 4.01//en" "http://www.w3.org/tr/html4/strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>projects</title> <style type="text/css"> @import "css/test.css"; @import "http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.23/themes/smoothness/jquery-ui.css"; </style> <script type="text/javascript" language="javascript" charset="utf-8" src="js/jquery.min.js"></script> </head>
the issue none of files in projects.php found. because browser looking main directory (where index.php is).
the test.css in "tables/php/css/test.css" , location of projects.php , index.php.
i think answer these solve problem.
Comments
Post a Comment