Remote Content
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 posted this at 09:07 — 11th January 2006.
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 posted this at 13:56 — 11th January 2006.
He has: 3,278 posts
Joined: May 2005
a php include or an iframe can be used for this
Abhishek Reddy posted this at 14:02 — 11th January 2006.
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 posted this at 17:24 — 11th January 2006.
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.
Tim
http://www.tandswebdesign.com
airoid3000 posted this at 04:55 — 12th January 2006.
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 posted this at 05:21 — 12th January 2006.
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 posted this at 06:49 — 12th January 2006.
He has: 3,022 posts
Joined: Oct 2002
Or, what you can do is use javascript.
Have something like:
<script type="text/javascript" src="http://www.domain.com/scripts/footer.js"></script>
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
demonhale posted this at 06:52 — 12th January 2006.
He has: 3,278 posts
Joined: May 2005
not unless of course the browser doesnt support javascript or its turned off
airoid3000 posted this at 19:28 — 12th January 2006.
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 posted this at 19:36 — 12th January 2006.
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.
airoid3000 posted this at 05:33 — 13th January 2006.
They have: 71 posts
Joined: Mar 2004
I added a system wide mime type to recognize html as php. It's working perfectly, thanks!
airoid3000 posted this at 21:08 — 14th January 2006.
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 posted this at 10:13 — 15th January 2006.
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.