Owlie42
09-13-2005, 08:59 PM
I'm more than a little confused. First, am I correct in making the assumption that all pages have to have a .php extension? Second, what are the "header" and "footer" for? Third, how would you covert a layout to PHP? Just stick the PHP in there or what? (I sound like such a newbie. :lol: )
putnamehere
09-13-2005, 09:17 PM
Your pages can be .php .phtml .php3 and sometimes .html but if you want that then the php code has to be on a different php file and it is called on by the html. and by head and footer i dont get you ther. to convert your layoout to php it sould be coded in php i guess but if you are jsut wanting you extentions to be .php then jsut mkae them like that with no php in them.
Monkey Bizzle
09-13-2005, 10:11 PM
If you want PHP to work then yes, all of your pages have to be .php. To "convert" all you have to do is save it as "whatever.php" with the quotation marks.
The header and footer are for PHP includes. Basically, those 2 files contain your normal header and footer code (<html> <head> <title>, etc...) that will appear on EVERY page. Then, you can "include" it with a simple line of code...
Not really sure if I made that clear enough... You might want to check out Lissa's page on PHP includes. That might explain what the header and footer are for a little better =)
Douglas
09-13-2005, 10:29 PM
you dont need to use includes if you dont want to, most people think that is the main purpose of php but its not, you can have other extensions than .php, as putnamehere said, .php, .phtml, its best just to stick to those two because they are for all versions of php, also you can change any extension to be parsed as php like .html, .phpfile, .htm, .nofile, .ext, anything, just put this in your htaccess file:
AddType application/x-httpd-php .html .php .htm .blah .ext
now .html .php .htm .blah and .ext will be parsed as php
(your host needs to support htaccess), more on includes,
you dont need to have them , make a file , any extension,
<?
header("Content-Type: text/html; charset=iso-8859-1");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>
<!-- PHP FILE -->
<!-- header.php -->
<html>
<head>
<title><?= $page_title; ?></title>
<!-- OTHER META -->
</head>
<body>
and footer file:
<!-- PHP FILE -->
<!-- footer.php -->
</body>
</html>
now just the regular file:
<?
$page_title="File 1";
include("header.php");
?>
<!-- PHP FILE -->
<!-- file.php -->
<center>Blah Blah Blah</center>
<? include("footer.php"); ?>
and maybe another file:
<?
$page_title="File 2";
include("header.php");
?>
<!-- PHP FILE -->
<!-- file2.php -->
<center><b>Blah Blah Blah</b></center>
<? include("footer.php"); ?>
the include() function includes any type of file type, but dont use addresses:
http://www.yoursite.com/blah/blah.php
wont work, just /blah/blah.php ok?
Owlie42
09-13-2005, 10:55 PM
So the header and footer aren't absolutely necessary? My current layout is div-based. Can I still use it, or do I have to do something special and then add the fanbase stuff to it?
Monkey Bizzle
09-14-2005, 12:24 AM
So the header and footer aren't absolutely necessary?
It depends on what code is in them. I downloaded the program so I could explain this better...
If you look at what's in "header.inc":
<html>
<head>
<title>PHPFanBase Version 1.0________________________________brought to you by Sasha</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
and then look at what's in "join.php" for example:
<?
include("config.php");
include("$header");
if (!$action) { ?>
<p>Fill out the form below to join this fanlisting. Please make sure you've read the rules and if you have a website, that you put a link back up to <?=$siteurl?> before joining!</p> blah blah blah and some other stuff after this...
see the line that says "...include("$header");..." When the page "join.php" loads, the browser is going to look for "header.inc." It will take whatever code is in the header file and put it where that line of code is. In this case, it is the necessary beginning HTML tags. The rest of the files probably have the same line. The purpose is so you only have to update one file rather than all of your pages... Like if you wanted to change the title to "My Fan Site" then you would change the "header.inc" to look like this:
<html>
<head>
<title>My Fan Site</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
And then on all of the pages that include the "header.inc" file will automatically change, rather than having to change the title on all of your pages.
The other stuff, like "...include("config.php");..." IS necessary... It is looking for the info that you put in your "config.php" file.
You can still use your div layout, but you should edit the pages that came with the phpfanbase program. Any code that is to go at the beginning of ALL the pages, that's what goes in the "header.inc" file and any code that is to go at the end of ALL the pages, that is what goes in the "footer.inc" file.
PHP is a little confusing at first... To run the fansite, you really don't need to know how it works... The only aspect you have to understand is the includes part. If you still don't get it, I'll help you make it work with your layout, if you want. Just send me a PM if you want me to help =)