John T Posted April 18, 2011 Share Posted April 18, 2011 Hi I am developing on wampserver a site that will have approx 50 pages in html. For ease of site admin I would like all maintenance in one place. So I have created “withmenu.php”, which has my style sheet .css, and a jqueryslidemenu and some html for the slide menu. I also have a footer.php. The problem is perhaps very basic but I have been unable to get either of them called to pages. I have looked in tutorials but am still stumped. I have tried <?php include(“withmenu.php”);?> and <?php include(“footer.php”);?> I have also tried using <?php require?> Also with single quote marks ' but nothing happens. I have tried at the top of the page before doc type, also without any html on the page, I have tried naming all pages with .php Any ideas of what I am doing wrong or not doing please. This is what I have on my page at the last attempt. <? require('withmenu.php');?> <div id="content"> <h2>the page header</h2> <p> some text. </p> </div> Thanks for reading this. Any help would be good. Quote Link to comment https://forums.phpfreaks.com/topic/234099-problem-calling-headerphp/ Share on other sites More sharing options...
micah1701 Posted April 18, 2011 Share Posted April 18, 2011 dumb question, but are you sure you're running a PHP server? if you create a page called "test.php" and put this code in it: <?php phpinfo(); ?> what happens? Quote Link to comment https://forums.phpfreaks.com/topic/234099-problem-calling-headerphp/#findComment-1203221 Share on other sites More sharing options...
John T Posted April 18, 2011 Author Share Posted April 18, 2011 Yes I have another site on the server using a commercial program that is all php. Quote Link to comment https://forums.phpfreaks.com/topic/234099-problem-calling-headerphp/#findComment-1203226 Share on other sites More sharing options...
John T Posted April 18, 2011 Author Share Posted April 18, 2011 <?php phpinfo(); ?> Returns a blank page Quote Link to comment https://forums.phpfreaks.com/topic/234099-problem-calling-headerphp/#findComment-1203228 Share on other sites More sharing options...
AbraCadaver Posted April 18, 2011 Share Posted April 18, 2011 <?php error_reporting(E_ALL); ini_set('display_errors', '1'); require('withmenu.php'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/234099-problem-calling-headerphp/#findComment-1203230 Share on other sites More sharing options...
John T Posted April 18, 2011 Author Share Posted April 18, 2011 <?php error_reporting(E_ALL); ini_set('display_errors', '1'); require('withmenu.php'); ?> Thanks Shawn, This showed no erros Quote Link to comment https://forums.phpfreaks.com/topic/234099-problem-calling-headerphp/#findComment-1203235 Share on other sites More sharing options...
PFMaBiSmAd Posted April 18, 2011 Share Posted April 18, 2011 Are you browsing to the URL for your page - http://localhost/your_file.php Quote Link to comment https://forums.phpfreaks.com/topic/234099-problem-calling-headerphp/#findComment-1203239 Share on other sites More sharing options...
John T Posted April 19, 2011 Author Share Posted April 19, 2011 Yes I am browsing to the URL for your page - http://localhost/your_file.php. If I change the file extension to html it works. Is there a way I can call an HTML file like I can call style sheet .css? Quote Link to comment https://forums.phpfreaks.com/topic/234099-problem-calling-headerphp/#findComment-1203372 Share on other sites More sharing options...
Muddy_Funster Posted April 19, 2011 Share Posted April 19, 2011 <?php phpinfo(); ?> Returns a blank page That's a problem. You should get all your PHP settings listed on the page. Also, you shouldn't use () with require - it's not a function. Quote Link to comment https://forums.phpfreaks.com/topic/234099-problem-calling-headerphp/#findComment-1203376 Share on other sites More sharing options...
John T Posted April 19, 2011 Author Share Posted April 19, 2011 <?php phpinfo(); ?> Returns a blank page That's a problem. You should get all your PHP settings listed on the page. Also, you shouldn't use () with require - it's not a function. Thanks for the reply. I assume that <?php phpinfo(); ?> is at the top of my page as that is where I tried it. Even on known working php pages it still shows no php, the page opens in my browser as if it were an html page I have taken out the () but made no difference. I have been reading more tutorials and have read that CSS and PHP menus should not be called from the same file so, I have also tried that. Calling style sheets then calling what is now called menu.php in my page results in the styles working but still no menu. More reading to do I think! Quote Link to comment https://forums.phpfreaks.com/topic/234099-problem-calling-headerphp/#findComment-1203700 Share on other sites More sharing options...
Muddy_Funster Posted April 20, 2011 Share Posted April 20, 2011 No, it should be on a totally new page - all by it's self. call it something like 'test_info.php' then point your browser at 'http://domain/directory/test_info.php' (that is assuming you didn't save the file in the web rout, if you did ignore the /directory part). Try that and let us know how you get on. Quote Link to comment https://forums.phpfreaks.com/topic/234099-problem-calling-headerphp/#findComment-1203875 Share on other sites More sharing options...
John T Posted April 20, 2011 Author Share Posted April 20, 2011 No, it should be on a totally new page - all by it's self. call it something like 'test_info.php' then point your browser at 'http://domain/directory/test_info.php' (that is assuming you didn't save the file in the web rout, if you did ignore the /directory part). Try that and let us know how you get on. Well I got that wrong! I have now called test.php in my browser and the page returned <?php phpinfo(); ?> Is that what should have been shown? Thanks again. Quote Link to comment https://forums.phpfreaks.com/topic/234099-problem-calling-headerphp/#findComment-1203960 Share on other sites More sharing options...
Muddy_Funster Posted April 20, 2011 Share Posted April 20, 2011 No, you should have had a long set of tables giving all the settings that are stored in PHP.ini Either php is not enabled on the server that you are using for this project, or (mainly with IIS and fast cgi) the directory that you using is not set to allow scripting and execution. Quote Link to comment https://forums.phpfreaks.com/topic/234099-problem-calling-headerphp/#findComment-1203966 Share on other sites More sharing options...
John T Posted April 20, 2011 Author Share Posted April 20, 2011 No, you should have had a long set of tables giving all the settings that are stored in PHP.ini Either php is not enabled on the server that you are using for this project, or (mainly with IIS and fast cgi) the directory that you using is not set to allow scripting and execution. Big mistake! just been reading info on php on my wampserver. Did not know there were two different php.ini files. One for production (reconmended) and another for developement. I have no idea which one I am using or how to check what is being run on it. The thing that gets me is I am using on the same server a commercial genealogy program that only uses php and, that works fine. Perhaps I should take up golf instead! lol Quote Link to comment https://forums.phpfreaks.com/topic/234099-problem-calling-headerphp/#findComment-1204009 Share on other sites More sharing options...
Muddy_Funster Posted April 20, 2011 Share Posted April 20, 2011 haha I find golf even more frustrating . fact is you are using neither of the two files you listed. the only file you will be using is php.ini if you don't have a fille called that, either in your %windir% or in the php core folder, then you will need to rename one of the two files that listed to be php.ini - I would suggest the development one, as that will have the error reporting turned on. Look up the guides here at freaks and go through the guide for installing a WAMP server for your php version to double check that all the other settings are as they should be. Quote Link to comment https://forums.phpfreaks.com/topic/234099-problem-calling-headerphp/#findComment-1204018 Share on other sites More sharing options...
John T Posted April 20, 2011 Author Share Posted April 20, 2011 haha I find golf even more frustrating . fact is you are using neither of the two files you listed. the only file you will be using is php.ini if you don't have a fille called that, either in your %windir% or in the php core folder, then you will need to rename one of the two files that listed to be php.ini - I would suggest the development one, as that will have the error reporting turned on. Look up the guides here at freaks and go through the guide for installing a WAMP server for your php version to double check that all the other settings are as they should be. Yes thanks again, I will have a look at the guide. I have a couple of screen shots from my wamp. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/234099-problem-calling-headerphp/#findComment-1204034 Share on other sites More sharing options...
John T Posted April 21, 2011 Author Share Posted April 21, 2011 haha I find golf even more frustrating . fact is you are using neither of the two files you listed. the only file you will be using is php.ini if you don't have a fille called that, either in your %windir% or in the php core folder, then you will need to rename one of the two files that listed to be php.ini - I would suggest the development one, as that will have the error reporting turned on. Look up the guides here at freaks and go through the guide for installing a WAMP server for your php version to double check that all the other settings are as they should be. Phew!!! Read the info that comes with wamp etc. got lost! could not find the docs on the forum. So I started looking in the files in Apache. I thought I had broken Myphp admin, loads of errors, could not see any data base. Turned it off and went to bed. Looked again today and php admin was working again. So I have re loaded PHP 5.3.0 and re ran test.php, Lo and behold all the php info came up. Now back to the original problem. At least it has saved me going to the sport shop for golf clubs lol. Quote Link to comment https://forums.phpfreaks.com/topic/234099-problem-calling-headerphp/#findComment-1204382 Share on other sites More sharing options...
John T Posted April 21, 2011 Author Share Posted April 21, 2011 Phew! I looked at the docs that came with wamp, apache and php as I could not find in this site. lots of reading got so confused! had a look in the files and then php admin threw up lots of errors. Could not see any data bases nothing at all! Went to bed. Opened wamp today and php admin was working again. Re installed php 5.3.0. and re ran test.php and lo and behold up came all the info regarding installed php files. YES, YES, YES calling php now works using <div id="nav"> <?php require 'withmenu.php'; ?> </div> I think when I first installed Wamp Server I was overwhelmed with the set up procedure and 'cut corners' also not knowing what should load or not did not help. I know it is free but some screen shots would have helped. A big thanks for all your help and happy Easter. Regards, John. Quote Link to comment https://forums.phpfreaks.com/topic/234099-problem-calling-headerphp/#findComment-1204393 Share on other sites More sharing options...
Muddy_Funster Posted April 21, 2011 Share Posted April 21, 2011 glad you got there in the end , I havn't used WAMP before, but I may take a look at it soon and see what it's like. Quote Link to comment https://forums.phpfreaks.com/topic/234099-problem-calling-headerphp/#findComment-1204395 Share on other sites More sharing options...
John T Posted April 21, 2011 Author Share Posted April 21, 2011 I think you would get on ok as you seem to be 'clued up' on these things. I only started 'playing' with web sites in January. Best of luck Quote Link to comment https://forums.phpfreaks.com/topic/234099-problem-calling-headerphp/#findComment-1204396 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.