barkera Posted January 30, 2006 Share Posted January 30, 2006 Hi, I hae a website where I have one thing that appears on every page of the website (just text) is there anyway in PhP to run a seperate single file that I can edit which will change all of the pages? and if so how? or is there a better language to do it in? Thanks. Link to comment Share on other sites More sharing options...
Eric Posted January 30, 2006 Share Posted January 30, 2006 Either include() or require()The difference:If the file fails to load, it will just issue warnigns with include() and the rest of the page will still load.With require() if the file fails to load, the whole page won't load.<?phpinclude("the_file_to_include.extension");?> Link to comment Share on other sites More sharing options...
barkera Posted January 31, 2006 Author Share Posted January 31, 2006 Right, well I added that code in where I wnated the file and named the file and stuff, but nothing shows up where the code is on the page, heres what the php file has:<html><body>The server is Currently: OFFLINE</body></html>thats the file i'm linking to from all the pages and nothing shows up. What have I done wrong? Link to comment Share on other sites More sharing options...
Eric Posted January 31, 2006 Share Posted January 31, 2006 What is the entire code? (with the php bits included, not just the html stuff) Link to comment Share on other sites More sharing options...
barkera Posted January 31, 2006 Author Share Posted January 31, 2006 Thats it, I thought all I had to do was create a new file and the php on each page would link to it, lol, guess not. Wha should I have done? Link to comment Share on other sites More sharing options...
Eric Posted January 31, 2006 Share Posted January 31, 2006 Oh, so that's the file you want to include into other pages?Well I'll highlight in red what to remove<html><body>The server is Currently: OFFLINE</body></html>If you put those tags in the file, then they'll be included in the other pages and you'll have 2 sets of the game tags.Put that in somefile.extension and then use include("somefile.extension"); in the other pages.If it still doesn't work, then can I see how you included it in the other pages? Link to comment Share on other sites More sharing options...
barkera Posted January 31, 2006 Author Share Posted January 31, 2006 still not working, heres ones of the pages and ho its put in:<div id="sectionLinks"> <h3>Server & IP Status: </h3> <?phpinclude("serverupdate.php");?> </div> Link to comment Share on other sites More sharing options...
Eric Posted January 31, 2006 Share Posted January 31, 2006 odd, it looks correct.Are you making sure to use the .php extension on that page? Link to comment Share on other sites More sharing options...
barkera Posted January 31, 2006 Author Share Posted January 31, 2006 yes, its a php extension. Link to comment Share on other sites More sharing options...
real_illusions Posted January 31, 2006 Share Posted January 31, 2006 are the 2 pages in the same folder?have you actually uploaded the updated page and the include file? (a surprisingly easy mistake to make actually..) Link to comment Share on other sites More sharing options...
barkera Posted January 31, 2006 Author Share Posted January 31, 2006 ah, I haven't actually put them on the net yet, but yes they are in the same folder and I tested out my site just from my PC, do I need to put them on the net to take effect? Link to comment Share on other sites More sharing options...
real_illusions Posted January 31, 2006 Share Posted January 31, 2006 that might be the problemphp only works on a server, as its a server-side language. unless you got a server installed on your computer, then it wont work.you need to upload the files to a server for php to take effect. Link to comment Share on other sites More sharing options...
barkera Posted January 31, 2006 Author Share Posted January 31, 2006 oh, k, kool thanks, I'll try it online now Link to comment Share on other sites More sharing options...
barkera Posted January 31, 2006 Author Share Posted January 31, 2006 Wow, new problem my website doesn't let me upload .php files, fantastic >_> stupid bravehost. Cany anyone recommend me a good website hoster that isn't bravehost or freewebs? thanks. Link to comment Share on other sites More sharing options...
Eric Posted January 31, 2006 Share Posted January 31, 2006 Depends on if you want a free webhost or one you have to pay for?(so I know what to search for)There is also a topic I think, pinned I believe, of free hosts that offer PHP Link to comment Share on other sites More sharing options...
barkera Posted February 1, 2006 Author Share Posted February 1, 2006 k, i'll look at the topic, and yes free would be good, thanks. Link to comment Share on other sites More sharing options...
Eric Posted February 1, 2006 Share Posted February 1, 2006 I found this on google.It seems to be a chart of various free hosts that allow phphttp://www.0php.com/free_PHP_hosting.php Link to comment Share on other sites More sharing options...
barkera Posted February 1, 2006 Author Share Posted February 1, 2006 thanks, i'll check it out. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now