Remote Content

They have: 71 posts

Joined: Mar 2004

I am trying to find a way of having one file with text in it that displays on several other websites. Currently, when I update the text, I have to go to each invidivual website and update it. I would like to update just one file and have all of the websites update instead.

Does anyone know how to pull this off? Thanks!

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

Well, one way I can think of would be to use an include.

If your hosts support PHP, then you can add this line to your code:

<?php
include(\"http://www.domain.com/includes/file.txt\");
?>

demonhale's picture

He has: 3,278 posts

Joined: May 2005

a php include or an iframe can be used for this

Abhishek Reddy's picture

He has: 3,348 posts

Joined: Jul 2001

Depending on the nature of your updated text, using an RSS feed might be a good fit.

What is the text? Mainly, is it small?

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

If all the sites are on the same server, you could pull the content from a database.

My full portfolio is on this site: tandswebdesign.com

My partial, religious-site portfolio is here: churchesofchristonline.com

They both pull from the same database.

They have: 71 posts

Joined: Mar 2004

I forgot to mention I need to keep the style's on the individual websites, which I can not do with an iframe. Also, not all of the pages are php pages, so I can do a php include.

Any other suggestions? It is only the copyright information at the bottom of the page. Would an RSS feed be a good idea? If so, please let me know how this works. Thanks.

demonhale's picture

He has: 3,278 posts

Joined: May 2005

all regular html files can be saved as php then insert your include strings for the pages...

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

Or, what you can do is use javascript.

Have something like:

&lt;script type="text/javascript" src="http://www.domain.com/scripts/footer.js"&gt;&lt;/script&gt;
'

In the .js file, have something like:

document.write("<p>This is the footer</p>");
document.write("<p>This is is another paragraph</p>");
'

Quite tedius, but it works, I guess Plain

demonhale's picture

He has: 3,278 posts

Joined: May 2005

not unless of course the browser doesnt support javascript or its turned off

They have: 71 posts

Joined: Mar 2004

Would you recommend renaming the thousands of pages I have to PHP or using javascript?

Can't I just do a tag for browsers without javascript? This wouldn't allow for updates but at least I can show the © without the year.

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

You don't actually have to rename them to PHP. Your htaccess file can be set up to interpret all html as php.

They have: 71 posts

Joined: Mar 2004

I added a system wide mime type to recognize html as php. It's working perfectly, thanks!

They have: 71 posts

Joined: Mar 2004

Okay, I ran into one problem. I tried to add .shtml pages to be recognized as php, but apparently you can not have the handler "server-parsed" and php at the same time.

Does anyone know of a way around this?

chrishirst's picture

He has: 379 posts

Joined: Apr 2005

There isn't one, Only one handler can exist for any extension.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.