- This topic is empty.
January 4, 2011 at 1:30 pm #31153Nato595Member
I have about 10 different pages that I want to all display the same string of text, which changes often. Without using an iFrame, how can I embed this string of text onto each of the ten pages? My goal is to only have to change the text in one file rather than all ten.
Thanks in advance!January 4, 2011 at 1:42 pm #67586clokey2kParticipant
Server side languages would be the best way of choice. Using a ‘php’ include() to bring the text in. There are plenty of tutorials out there for this sort of thing – Google is your friend.
Yes! That did it, thank you!!
BTW, it too me a while to figure out that my main page had to be a PHP file to use a PHP Include. However, the file that I am pulling the embedded text from seems to be able to be any extension; .HTM, .PHP, .TXT, etc.January 4, 2011 at 4:24 pm #67596clokey2kParticipant
if you use a ‘.htm’ file then you could access it’s contents from the URL, not always desired.
The best use for a basic php include would be declaring some global variables. If you were to create and include a file at the top of your document that contained php like this:
global $sitetitle = "My Site";
global $funnymsg = "Theory and practice are the same, in theory. But different in practice";
You could then use the variable whenever you liked:
Welcome to !
Here at we want you to know that
If someone was to load just the include into their browser they would see nothing, as no HTML is generated. That’s why dynamic pages rock!
(The code above has not been checked for errors!)
- The forum ‘CSS’ is closed to new topics and replies.