Minimeallolla Posted February 18, 2011 Share Posted February 18, 2011 I'm using XHTML 1.0 Transitional and in a line of my code I have used: "<?php include ("drop_down_menu.php"); ?>" I've tried changing the file type to .html but it doesn't work either, unless I actually copy and paste the content in the index file. \= Is it XHTML 1.0 Transitional that doesn't allow this? I've previously worked with HTML 4.01 Transitional and it worked. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 18, 2011 Share Posted February 18, 2011 The doctype has nothing to do with php. I'd suspect this is a path issue. Try using require() instead of include and see what errors are returned. Quote Link to comment Share on other sites More sharing options...
Minimeallolla Posted February 18, 2011 Author Share Posted February 18, 2011 Well I currently don't have a server/ftp nor is the site hosted atm. I'm wanting to store abit of html code in another file and then use php in my index to call on that file but it's not working. I havn't used php in a very long time and have forgotten most of it. <?php include ("Drop_Down_Menu.php"); ?> It's not a problem with the file path. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted February 18, 2011 Share Posted February 18, 2011 PHP will not work without a server. How are you invoking the source file and what is it's extension? Ken Quote Link to comment Share on other sites More sharing options...
Minimeallolla Posted February 18, 2011 Author Share Posted February 18, 2011 <?php include ("Drop_Down_Menu.php"); ?> and the index is .html ? I'm trying to put html code into a php file and then on my index.html call on that php file so my index.html isn't jammed with codes. Sorry to sound like such a noob lol \= So I can't use the include function without hosting it as a proper website? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted February 18, 2011 Share Posted February 18, 2011 You can always run a local webserver on you local machine. I use xampp on my windows laptop. Ken Quote Link to comment Share on other sites More sharing options...
Minimeallolla Posted February 18, 2011 Author Share Posted February 18, 2011 Oh. I'm on a DET laptop which is highly restricted -.- wamp and xammp cannot be installed \= My main laptop recently broke and use this because it's small, portable and easy to code on. Quote Link to comment Share on other sites More sharing options...
phil88 Posted February 18, 2011 Share Posted February 18, 2011 Can you run stuff from USB sticks? I've got xampplite on my USB stick and it runs fine without needing to install anything. Quote Link to comment Share on other sites More sharing options...
trq Posted February 18, 2011 Share Posted February 18, 2011 Oh. I'm on a DET laptop which is highly restricted -.- wamp and xammp cannot be installed \= My main laptop recently broke and use this because it's small, portable and easy to code on. You are aware that PHP is used to extend servers functionality? Without a server there is no PHP unless your are writting simple cli scripts. Quote Link to comment Share on other sites More sharing options...
Minimeallolla Posted February 18, 2011 Author Share Posted February 18, 2011 Only if it's portable \= and thorpe. I only wanted to use the include function for now untill I do have further access. Just to neaten up my files lol. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 18, 2011 Share Posted February 18, 2011 Without a webserver running php, how do expect a php function would work? Why not sign up for a free webhosting account that supports php until you can get something set up locally? Quote Link to comment Share on other sites More sharing options...
Minimeallolla Posted February 18, 2011 Author Share Posted February 18, 2011 Long story, lets just say I very limited internet access, for now anyways. I only wanted the include function, it's not like that function along requires a whole server. I guess I can go without php for a while lol. Thanks anyway though Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 18, 2011 Share Posted February 18, 2011 Yes, actually that function does require a whole server. Since it's a part of php, which requires a webserver be running and configured to pass the code through the php interpreter, it will not work without it. The browser interprets and renders HTML, the php interpreter interprets php code, and sends the resulting html markup to the browser. Without it, raw php is sent to the browser, which has no idea what to do with it. I hope that makes sense, because you really need to understand how php works or you're doomed to a life of frustration. Quote Link to comment Share on other sites More sharing options...
Minimeallolla Posted February 18, 2011 Author Share Posted February 18, 2011 Ohk. Thanks for the tip Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.