RE: Website Comments (PHP)

by Jason <dawgclan(at)shaw.ca>

 Date:  Mon, 24 Feb 2003 08:34:12 -0800
 To:  "'Davies,
Elizabeth H.'" <EHDavies(at)West.com>,
hwg-techniques(at)hwg.org
 In-Reply-To:  westworlds
  todo: View Thread, Original
Yeah thanks for that, I was going to make it all in one database, but
then My Step-Dad the owner of the page I'm making knows nothing of HTML
yet alone SQL, to edit the pages when he needs to. So we made our own
text database, it explodes by </tr> tags and then we just add a </tr> at
the end. It is shown in the directory page, This allows for easy text
modifying.

At Current, I have footer in the index.php as it is on all pages, it is
not an include. The banner is also in the index.php so really all I am
including is the menu and content pages, and I just include them into
<td> tags, the menu is 110pixels wide, the content is the rest. On some
of the include content pages I have an include for contact information
as it shows up quite often.

I would still like some suggestions on design and/or code improvement.
Our text database script looks rather messy, I would like to improve it
later. This Website is a challenge, the old one http://www.ozeco.com.au
was made in Publisher, if you look around in it, Publisher is something
you never want to use :) the front page is 800K of sourcecode. So I am
currently just moving all the content into clean HTML notepad coded
pages :) Then I will work on design.

I Create unique titles by checking if page isn't set or page = main, to
not echo any extra title. But if it's not main and it exists you will
see it echo's the page name after a "::" all includes are small case so
I used str() functions to capitalize first letter and leave the rest.

As much as I hate using Javascript, this script won't stop anything
important, so I left the no right click script on to protect his
source/images a little better, do you think this is necessary?

Still unsure of meta-tags, my idea was maybe either having all the same
meta-tags and just putting it in the index.php while echo'ing out page
if it's set, or since php is executed first, I can put one php line on
each content page something like <?php $metatags="Whatever" ?> and print
that... I'm not sure what to do, suggestions on this would also be
great.

Small Question :)
Is the open tag <? Or <?php a friend of mine used <? But I've been using
<?php

Thanks again, Big message :)
Jason

-----Original Message-----
From: owner-hwg-techniques(at)hwg.org [mailto:owner-hwg-techniques(at)hwg.org]
On Behalf Of Davies, Elizabeth H.
Sent: Monday, February 24, 2003 6:50 AM
To: hwg-techniques(at)hwg.org
Subject: RE: Website Comments (PHP)

There are two (basic) schools of thought with PHP dynamic layouts. One
is that you have one page. That one page contains the repetitive
contents and each menu "link" calls an object that becomes the unique
content. There is usually only one PHP file that contains many modules,
each of which represents a page of unique content. The other is that you
have many pages, one for each unique content and use the include
functions to pull in your repetetive content. I think that which to use
is pretty much governed by the type of site. Obviously there are
combinations of the two.

My preference is to have many pages and use includes for the repetetive
elements. I layout my sites with "containers" in mind, and design
different objects/includes for each repetetive element. Depending on how
important search engines are to that site, I may or may not make the
META portions part of an include. Typically I will have the beginning
part of the header  as include #1, but not the entire header. This
leaves me flexibility to insert unique META data as well as scripting
and style if needed. I also have my menu's as includes as well as my
footer. I find this makes it easier for me to troubleshoot. If I find
that there is a block of information repeated on many pages, I make it
into an include (and of course document what the heck it is). In
addition, many of my pages/sites tend to be database intensive and are
built with queries. By splitting the logical arguments up onto their own
pages (vs. having one giant php page) ... it speeds things up and makes
troubleshooting MUCH easier. So I only break one page instead of 100.
(unless of course I mess up one of the includes but I try not to do that
very often)

HOWEVER, if I have a page whose display is dependant on who is looking
at it: ie) different authorizations levels, the various views are all
contained in one PHP file and doled out according to a series of logical
"if" statements. An example might be a member-only website where a
regular member might only see a list of other members and be able to
modify their own profile, but a board member would see a list that you
could add to, delete from, and edit with a drill down to full profile
information. The page is one file, but different folks see different
things.

Elizabeth Davies
Web Designer
West Interactive Corporation

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA