View Full Version : footer


ujongpasir
08-15-2009, 02:12 PM
Hello I am a newbie to writing HTML. I use .php for my files. Believe it not I ain't got a clue as of yet with regards to changing Fonts types and size. For the moment I am trying to link all the page to the index.php page when opening on the internet.

I believe I have to do something or enter the correct text somewhere in a given footer.php file with:

</div>
</body></html>

Can anyone out there tell me what and where do I enter the text so each page is linked to the index.php or front page?

Thank you

b3ns
08-15-2009, 02:50 PM
I think its best if you went back to basics with HTML and creating web pages. Start here: http://lissaexplains.com/basics.shtml and once you've completed the basics go onto the HTML section. But I'll answer your question anyway:

Generally HTML files / web pages start with this basic code (and I'll explain what each bit of code does too):


<html>
<head>
<title>Your website title will go here</title>
</head>
<body>

</body>
</html>

The <head> tag is basically everything that's "before the Web page" - i.e. the site title - everything that isn't displayed on the page itself. In the <head> tag there is a <title> tag, which is for the title of your web page (for instance, in this topic at the top of your screen you'll see a title called "footer - Lissa Explains it All: Web Design Forums". All HTML tags have corresponding starting and ending tags. For example, <title> and </title> and its to denote where that particular tag starts and ends.

The <body> tag is all the content to be displayed on the page that's viewable when you see it from a web site. So for example, here is a really basic web page:


<html>
<head>
<title>This is my title!</title>
</head>
<body>
This text will be displayed on my web page
</body>
</html>

Good luck :).

ujongpasir
08-15-2009, 07:04 PM
I am sorry if I misinterpreted my request. I understand the initial format of creating a page.

If I can make myself clearer my needs. Say, I have several pages in my website and I do not need to use a menu bar. Instead the links from an index.html or index.php is the Main Page. I then link a word or text to show explanation to the word or text the link page opens.

After opening the linked page I then want to go back to the main page i.e. index.html or index.php, normally on every page there at the foot would be a <a href="index.html or index.php"><b>Main Page</b></a> . However, as there are many pages to link from the main page I want to just create a file called a footer.php with
</div>
</body></html>
This should be the file i upload but I need to place some text to add somewhere in the footer.php file to make it work so all pages are linked to the index.html or index.php. top of its page. In essence if the index.html or index.php has the same at its foot of the page the link in itself will when clicked will link to the top of the Main Page.

I hope you can see what I am trying to get at.

Thanks

iGeek
08-16-2009, 02:44 AM
What you are looking for is a template system. The most crude (but effective) PHP template system is simply using include() to include the header and footer. For instance, my header would look like this:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />

<title><?php echo $title; ?></title>
</head>

<body>

And my footer:

</body>
</html>

To make a page, I would do something like this:


<?php

$title = 'My Site';

include('./header.php');

?>

<p>This is plain HTML</p>

<?php

include('./footer.php');

?>

ujongpasir
08-16-2009, 08:09 AM
Oh dear!, Now I am confused. Knowing only only the very, very basic of preparing a page for a .php file I have now got myself in a twist. Believe it or not iGEEK, I am 'SOLID GONE!' as Baloo in Jungle Book would say. I am 'Lost in Space'.

Gee Man! What have I got myself involved. What you sent me is something I do not have a clue. Please forgive me for being so, so ignorant. I thought when someone sent me the same (see below) as a file I was just to add them in my folder with the rest of my .php to upload. I thought this would automatically show a link at the bottom of each page on the Website to link to the Home Page. I got so confused when it not show any link so I then decided to make a,
<a href="index.php"><b>Home</b></a> on each page to show a link to the Main Page to go back. Gee! How stupid am I?

I was sent this below.
header.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Ultimate Simplistic Body Action</title>
<link rel="stylesheet" href="ben.css" type="text/css" />
<body>

<div class="ben">

footer.php
</div>
</body></html>

iGEEK can you please explain the header.php above sent to me of a .php text page I asked,as you will notice above, in a title "Ultimate Simplistic Body Action" would mean.
1) Would you say I have to copy and paste the header.php and footer.php text on each .php text file I created or composed (i.e. above and below each page) and to change the <title> accordingly in every page according to the page titled
2) At the footer.php if to copy and paste at the foot of the page, do I need to add any text somewhere between:
</div>
</body></html>

I will be grateful to you for your help.

But of course if I may refer you to my website for your critic maybe you will understand.

I am much obliged and many thanks

iGeek
08-16-2009, 07:58 PM
Here is a quote from an article I wrote some time ago:
So what exactly is a template engine? We've all heard of templating in general: have files with parts of a completed page and either place code between these files, or dynamically replace variables in them. This system can be a lifesaver for large sites - having just a few files with a template in them enables you to change those few files and completely change the look of hundreds of files (pages).

Basicaly you'll have two files - a header and a footer. The header contains everything before the content, and the footer contains everything after the content. To make a page, you'll simply do this:

<?php

$title = 'My Site';

include('./header.php');

?>

<p>This is plain HTML</p>

<?php

include('./footer.php');

?>

You save each page as you normally would (index, about, contact, etc). If you post the code for your template I can help you split it (remember to use [html] tags around your code). :)

ujongpasir
08-16-2009, 11:03 PM
I was thinking of sending you full text to the index.php or Main Page to you of my website. It looks very basic. I am also trying to find out what, how and where to enter html code to keep a border line on all sides so that the text do not encroach right to the edge of the screen when the site is opened.

Can you tell me if I am allowed to send you my website so you can see that it needs plenty to sort out.

I have, however, removed all the text and typed as you requested what I coded on my Main Page. I know you will be able to perceive what it would look like as a web page.


<head>
<link rel="stylesheet" type="text/css" href="ben.css" />
<TITLE>"My Title"</TITLE>
<META NAME="description" CONTENT="aliments, illness, aches and pains, disease to live better using simple action, free ebook with activity illustration position, guaranteed harmony ">
<META NAME="keywords" CONTENT="human, intuition, animal, instinct, body secret, harmony, body, secrets, aches, pains, illness, disease, health, problem, perfect, more than, the secret">
<META NAME="author" CONTENT="My Name">
</head>
<body>
<h1>"my title"</h1>
"my text here"
<br><br>"my text here"
<br><br>"my text here"
<br><br>"my text here"
<br><br>
<a href="index.php"><b>Home</b></a>
</body>

The basic links like <a href="title.php"><b>"Page Title"</b></a> is used on text or reference to open the page required.

Thanks again immensely

b3ns
08-17-2009, 12:47 PM
Basically, if you are using .php files (and your Web site has "PHP support") you can have a header.php and footer.php file which will not be directly related to your website...they'll just hold the HTML for the header and footer sections of your site. Then, in your header file include all the code ending with the <body> tag. The <body> tag is where all your content goes for your website, so make sure to include the <body> tag in your header file.

In the footer.php file include just two lines of code:

</body>
</html>

and in your index.php file this is, I presume, your main site page so include the following code:

<?php
include("header.php");
?>

Your plain HTML content goes here that'll be displayed on the page

<?php
include("footer.php");
?>

We have both PHP code and HTML code (or plain text, should I say) here. The PHP code is the stuff within the <?php and ?> tags and they're not anything to do with HTML. It's PHP code to simply include the contents of both the header.php and footer.php files. Then in the middle as shown is where all your page contents go.

I'm not sure exactly what you need help with so apologies if this doesn't answer your question.

ujongpasir
08-17-2009, 10:29 PM
I am confused really.
If I may. It would appear I will never know how to explain if there are errors on the website I developed. Unless you actually looked at my site and view the source.

It is not completed as there are many things I need to do. The basic is hopefully complete but I have a lot to learn with other codes to include image and email contact and I do complete it a payment portal.

I think in so far I have not use the </html> code in any of my page. But I seem to receive advise in codes sent with an entry with it. What would happen to the website if I did not include the</html>?

I am told if I learn HTML fully it is no different when using the html codes. I am told php is only a supporting or an easier method for developing website.

I am now becoming more confused. I have purchased a html book but I find it so confusing. I guess it may not be my vocation to be in this field.

However, if I am not being defaulted in this Forum here is my website
www.bodysecretsrevealed.com

The text are pretty tight to the edge of the screen and I have yet to find out the code to keep a clear border round the screen. I do not know here to insert the code even if I knew it. I suppose looking at other website's source would not help me.

I would appreciate it for any comments please

Thanks

ujongpasir
08-19-2009, 12:47 PM
in php I have this problem of aposthrophe.

This is an example.

prescription�s

Why a ? mark instead of '
Can anyone solve this problem for me?

Thanks

iTom
08-19-2009, 11:00 PM
The question mark is sometimes caused if you paste text in from Word or another word-processor. In your HTML, replace all apostrophes with "&quot;" (without the quotes).