We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Tag on Entire Site; PHP. Is it possible?
Topic Started: Jun 24 2005, 05:15 PM (546 Views)
shockwave-
My other title is a Ferrari
[ *  * ]
I'm creating a new site, and I want to add a tag to the bottom of every page on the entire site. I've seen things LIKE this done before in PHP, like on tutorial sites, or even Seth's site, where if you hover over a link, a caption will apear describing it.

I don't want to manually add the tag, that would be a pain, so is there a way to do this with PHP or, anything, really? If anyone could help, that'd be great.
Offline Profile Quote Post Goto Top
 
Ben
Member Avatar
Quantum-locked when observed.

I'm not quite sure by what you mean by a "tag," but one of the simplest ways to add in global footers in PHP is to do the following:

Put the footer in a file and name it something like footer.php. Then put this code at the bottom of each page:

Code:
 
<?php include "footer.php";?>


You can even go so far as to set up your site so everything is processed through index.php, where a header is displayed, the content, and then the footer.

To illustrate, here is the content of my site's index.php (slightly modified):
Code:
 
<?php

//About Me
$page["about"] = array(
"src" => "about",
"title" => "About Me",
);

//Index
$page["idx"] = array(
"src" => "idx",
"title" => "Catalystica Studios",
);

$act = $_REQUEST["act"];

if (empty($act))
{
$act = "idx";
}

include "php/top.php";
include($page[$act]["src"].".php");
include "php/bottom.php";
?>

As you can see, I code specific information about each page into an array. Then I include the header file, the page itself, and the footer file.
Offline Profile Quote Post Goto Top
 
shockwave-
My other title is a Ferrari
[ *  * ]
By tag, I mean an HTML element. Like say I wanted

<hr> to be at the bottom of every page. But thanks, I'll try it out.
Offline Profile Quote Post Goto Top
 
Ben
Member Avatar
Quantum-locked when observed.

shockwave-
June 24, 2005 06:27 PM
By tag, I mean an HTML element. Like say I wanted

<hr> to be at the bottom of every page. But thanks, I'll try it out.

Well then, putting "<hr>" in a file and using include() will indeed work. :yes:
Offline Profile Quote Post Goto Top
 
solinent
Member
[ *  *  * ]
It's the same as adding the <hr> though...lol

Do you have a head template or something? You need some sort of include(), you could put at bottom if you had one at top i think(no nvm you need an include at bottom).

Just have a footer include.
Offline Profile Quote Post Goto Top
 
shockwave-
My other title is a Ferrari
[ *  * ]
No, I wasn't actually going to use <hr>, it was an example.

Anyways, I got it working, thanks.
Offline Profile Quote Post Goto Top
 
solinent
Member
[ *  *  * ]
Oh and if you use IIS they have an option where you can include footers and headers in every single page.
Offline Profile Quote Post Goto Top
 
bag
Take Me To Your Larder
[ * ]
rather than manuly puting an include on every page of your site (if the navigtions not include based that is)

woulnt it be easyer just to use htaccess to do all the work for you?
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Technology Chat · Next Topic »
Add Reply