Page 1 of 1
Need advice.
Posted: Mon Oct 07, 2002 11:52 am
by jschner
I'd like to convert my site from individual pages to a shared header format similar to what this very forum uses.
I know very little about php and need to know is there an easy way to convert my site or would it be a very difficult thing to accomplish?
What would be the general steps and are there any templates or such out there I could use?
my site is located at
http://www.cannondaler.com
Big TIA!
Posted: Mon Oct 07, 2002 2:10 pm
by rev
You can probably find some 'templates' with a page layout using included headers and footers.
But, it's basic logic, so you can devise your own template with ease.
include() -
http://www.php.net/manual/en/function.include.php
require() -
http://www.php.net/manual/en/function.require.php
Code: Select all
<?php
require("/my/magic/header.php");
/* body content here */
require("/my/magic/footer.php");
?>
So, you may be wondering what goes in your header and footer. I cannot tell you everything, but I can make some suggestions.
I would go with the following items:
- page header, html, header, title, and body tags
- any repetitive data that you find yourself using over-and-over, etc...
Basically, use the header and footer to reduce redundancy on your site. Put content and data in these files that will make maintenance of your web site easier not more complicated.
Posted: Mon Oct 07, 2002 6:20 pm
by mydimension
to go a little bit further than rev did, lemme briefly explain how i do my sites. the basic layout for my site is this:
Code: Select all
<html>
<head>
<!-- headers -->
</head>
<body>
<!-- masthead (banner, top menu, other navigational stuff -->
<table>
<tr>
<td class="content">
<!-- this is the part of my site that changes from page to page -->
</td>
<td class="sidebar">
<!-- here i have a more complex menu system, user pannel, recent news, forums, etc. -->
</td>
</tr>
</table>
<!-- and here i put my copyright and other footer type material -->
</body>
</html>
so everything before my content area goes in to header.php and everything after it goes into footer.php and then each page looks like what rev posted. hope that helps.
Posted: Tue Oct 08, 2002 1:52 am
by jschner
Thank you very much. I can hardly believe I got my test file
http://www.cannondaler.com/main.php running the first try.
Are you guys for real it's this easy? Anything I should watch out for or make sure I include when I convert all the pages on my site?
If I add a left hand menu is it better in with the header or on it's own in a file like leftmenu.php? Also for body alignment reasons does a leftmenu.php type file create a table and a body.php type file finish it?
Thanks again. My site is starting to seem fun again.

Posted: Tue Oct 08, 2002 4:44 am
by Coco
no its not really that easy

just your playing with some of the easy bits, if it were that easy there wouldnt be forums like this
and as to having a leftmenu.php, its entirely up to you. personally it would depend upon whether you need to change it or not
eg...
Code: Select all
<?php
if($user='admin')
include leftadmin.php;
else
include leftgrunt.php;
?>
as always no syntax guarantee