Jump to content

LINK tag ?


sircharlo
 Share

Recommended Posts

Hi, everyone !I'm lookling for a way to create a link to an external file (txt or html, not important).Let me explain. I would have, say, 5 pages, and they would all have the same copyright notice, so instead of copying the notice and putting it on the 5 pages, i would put something like this:

<linkto type="text/html" src="copyright.html/txt">

on every page I wanted my copyright notice to appear on and it would display this (the content of copyrioght.html/txt):

Copyright © 2007 by Twit Industries

Is there a way of doing this ?Thank you

Link to comment
Share on other sites

You can use an .htaccess file and force the server to parse "html" pages as php. Easy.for that matter, it can be made to parse text files as php, too, if you want.Google is your friend. If I remember, I'll post the code for the htaccess later.

Link to comment
Share on other sites

You can either use a server-side include like aalbetski said, you can use a server-side scripting language to include the file like jlhaslip said, or you can use a full-blown AJAX script to get the external content and put it on the page somewhere. The first two methods are much easier.

Link to comment
Share on other sites

Here's an alternative thought: Put an <object> element in your pages that loads your copyright notice:

<html><body>   This is in the body<br>   <object style="border: 1px solid black; height: 2em; width: 30em;" type="text/html" data="copyright.html">   </object>this is after the inclusion.</body></html>

Then in copyright.html you could put:

<html><style type="text/css">  * {padding: 0px; margin: 0px;}</style><body><b>Copyright Kevin 16/10/2007</b></body></html>

I put the style things in to show where the object is - you may have to specify the size explicitly.Of course IE has to be difficult and makes it look like a text box.Personally I made an image for my copyright notice and included that into my pages.You could also do it with a javascript document.write() command.Kevin

Link to comment
Share on other sites

The auto_append_file directive "might" be available via .htaccess, also. It is set on a per-directory basis, but it may be that the Server Admins can stop it from happening, depends on the Server configuration and whether it would be allowed. And you would need to be running the files through the php parser, so if you are allowed to use php, add this to your .htaccess file in the folder where your file is:

<IfModule mod_php5.c>  php_value auto_append_file   "./test.html"</IfModule>

And a file named test.html that outputs some text. Run a file from that folder to see if the text is actually output as the footer. The "test.html" file should be treated exactly like an included file, which means the main file would have the closing body and html tag removed, with those closing tags placed in the test.html file. Understand???Any questions, post back... I'll send you a sample set of files if you PM your email address.*edit*Yes, it appears that the server configuration can affect the results. Tested it in localhost on XAMPP, works.Tested on my main Domain, works.Another test on a different Host , fails...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...