Jump to content

Problem calling header.php.


John T

Recommended Posts

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.

 

Link to comment
Share on other sites

<?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!

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

haha I find golf even more frustrating :D.  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.

Link to comment
Share on other sites

haha I find golf even more frustrating :D.  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]

Link to comment
Share on other sites

haha I find golf even more frustrating :D.  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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.