We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
PHP include help
Topic Started: Jun 3 2005, 10:46 AM (305 Views)
high elf-ZNS
Member
[ *  * ]
OK I'm designing a website and I've done it all through html and css, but I recently found out about the include function for php.

So I want to use it as there are going to be alot of pages on my sie and I don't fancy manually updating them each time I ad an affiliate or something new to the navigation etc.

So I took the navigation out the page I've done (just the template really no content) and saved it in another file as navigation.html and saved it in a folder called content.

So the link I used to it was:

Quote:
 
<?php
include("content/navigation.html");
?>


and it doesn't work, the navigation is just revoved :(

Sothen I tried saving it as navigation.php and linking in the same way to that and it still doesn't work. I've got apache, php and mysql set up and running on the computer using WAMP whih automatically configures them.

Can anyone shed some light on why this isn't working for me?
Offline Profile Quote Post Goto Top
 
Jory
Member Avatar
Member
[ *  *  *  *  *  * ]
You have to save the files as .php
(So also the file that you put the include in)

Try changing it to require() (works the same way)
It will give you an error if something is wrong.

Post the error here, might be usefull.
Offline Profile Quote Post Goto Top
 
high elf-ZNS
Member
[ *  * ]
The require doesn't work and I've saved both files as .php

WAMP is saying that all services are running, I don't get it because I don't get ay error message at all...
Offline Profile Quote Post Goto Top
 
Jory
Member Avatar
Member
[ *  *  *  *  *  * ]
Ok, do other php functions work??
(Just try something like <? echo 'php works'; ?> to check it if you are not sure)
Offline Profile Quote Post Goto Top
 
high elf-ZNS
Member
[ *  * ]
Nothing, I suppose there's somehing wrong with WAMP.

Do you know any free webhosts you can use php on and can you recomend a free easy to use ftp program. That way I could upload and test the code.
Offline Profile Quote Post Goto Top
 
Dennis
Member
[ *  *  *  *  *  *  * ]
FTP: SmartFTP.
Offline Profile Quote Post Goto Top
 
Jory
Member Avatar
Member
[ *  *  *  *  *  * ]
For testing stuff on your local pc, you could also use phpdev.
I love it :)
(exept it won't run MySQL for me, but thats because I messed it up somehow)
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Technology Chat · Next Topic »
Add Reply