| | Also- if you do not put the <?php ?> tags in, the browser will count it as HTML. so if you put this in an include file: $test1 = test2 echo ("$test1") the browser will count it as HTML. But if you put in the PHP tags it will display the echo script |
| Nov 8, 2009 |
You're right. I would much rather use PHP or some other include method, but I couldn't get those to work. and as for JavaScript not being enabled, my pages will still work even with out the includes. The pages just won't look quite as good, but will still be completely functional. But you are right: I wouldn't recommend JS includes either.
Cool il use that when i got those 50 posts or ten lol =)
Heres what I meant: With my order system i did a little bit of templating: http://www.shothost.com/order With my links directory I did the same thing: http://www.shothost.com/links Normally these scripts have a default boring look, but I have sort of customised it in a way, nothing to flash but it works for me. Maybe you guys could experiment
I have a question.. I had truble to put include text file without that it would but "1" in the end of the text? Where It came from? Finally I got rid of it, but still I don't understand why.....
I recently had some problem with includes. So here it is, if you know solution lemme know...
Problem: If you have one php file in your public_html/ folder, called index.php, and in that index.php you include another file which is in public_html/directory/file.php - and in that included file "file.php" there is another inclusion of public_html/directory2/file2.php how can you manage to work it out... ? It gets me lots of errors, and I end with solution that it can't be done, because if I include something in some file in root directory (e.q. index.php) script will stay executed in that directory (hipoteticly) and if I include file which has line of code in it self include("../directory2/file2.php"); what it really does it goes directory back beyond public_html and finds nothing... - complicated huh How to solve this complication? any suggestion for different programming...?
Hmm... maybe use absolute URLs? Instead of using relative urls like "../directory/index.html" you could use "http://whatever.astahost.com/directory.index.html" in your embedded file (in this case, file.php) so that you won't have to worry about the script staying in the first file and not budging.
Not a very elegant solution, but it might work if you only have a few files with this problem. QUOTE (chiiyo @ Apr 15 2005, 12:57 PM) Hmm... maybe use absolute URLs? Instead of using relative urls like "../directory/index.html" you could use "http://whatever.astahost.com/directory.index.html" in your embedded file (in this case, file.php) so that you won't have to worry about the script staying in the first file and not budging. Not a very elegant solution, but it might work if you only have a few files with this problem. Ii works in something like: QUOTE (Adapted from others websites) <html> <head> <title>Include Sample</title> </head> <body> <?php include("header.php"); ?> <table width="95%" cellspacing="15" cellpadding="5" border="0"> <tr> <td valign="top" width="120"> <?php include("menu.php") ?> </td> <td valign="top"> <?php switch ($_GET['c']) { case '1': include("content" . $_GET['c'] . ".php"); break; case '2': include("../www/file2/content" . $_GET['c'] . ".php"); break; case '3': include("../www/file3/content" . $_GET['c'] . ".php"); break; default: include('content1.php'); break; } ?> </td></tr></table> <?php include("footer.php"); ?> </body> </html> The $_GET['c'] comes from: QUOTE <p align="center" style="font:bold 1em sans-serif;color:#000099">
<a href="index.php?c=1">Home</a><br> <a href="index.php?c=2">Reality</a><br> <a href="index.php?c=3">Mision</a><br> </p>
Similar Topics
Keywords : Php Includes
Looking for php, includes
|
![]() Tutorial: PHP Includes |
Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com