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. Link to comment https://forums.phpfreaks.com/topic/228067-xhtml-10-php-include-doesnt-work-simple-command-someone-help/ 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. Link to comment https://forums.phpfreaks.com/topic/228067-xhtml-10-php-include-doesnt-work-simple-command-someone-help/#findComment-1176066 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. Link to comment https://forums.phpfreaks.com/topic/228067-xhtml-10-php-include-doesnt-work-simple-command-someone-help/#findComment-1176079 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 Link to comment https://forums.phpfreaks.com/topic/228067-xhtml-10-php-include-doesnt-work-simple-command-someone-help/#findComment-1176080 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? Link to comment https://forums.phpfreaks.com/topic/228067-xhtml-10-php-include-doesnt-work-simple-command-someone-help/#findComment-1176091 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 Link to comment https://forums.phpfreaks.com/topic/228067-xhtml-10-php-include-doesnt-work-simple-command-someone-help/#findComment-1176093 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. Link to comment https://forums.phpfreaks.com/topic/228067-xhtml-10-php-include-doesnt-work-simple-command-someone-help/#findComment-1176095 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. Link to comment https://forums.phpfreaks.com/topic/228067-xhtml-10-php-include-doesnt-work-simple-command-someone-help/#findComment-1176160 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. Link to comment https://forums.phpfreaks.com/topic/228067-xhtml-10-php-include-doesnt-work-simple-command-someone-help/#findComment-1176165 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. Link to comment https://forums.phpfreaks.com/topic/228067-xhtml-10-php-include-doesnt-work-simple-command-someone-help/#findComment-1176179 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? Link to comment https://forums.phpfreaks.com/topic/228067-xhtml-10-php-include-doesnt-work-simple-command-someone-help/#findComment-1176230 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 Link to comment https://forums.phpfreaks.com/topic/228067-xhtml-10-php-include-doesnt-work-simple-command-someone-help/#findComment-1176257 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. Link to comment https://forums.phpfreaks.com/topic/228067-xhtml-10-php-include-doesnt-work-simple-command-someone-help/#findComment-1176273 Share on other sites More sharing options...
Minimeallolla Posted February 18, 2011 Author Share Posted February 18, 2011 Ohk. Thanks for the tip Link to comment https://forums.phpfreaks.com/topic/228067-xhtml-10-php-include-doesnt-work-simple-command-someone-help/#findComment-1176290 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.